ConvolutionBackwardData#

ConvolutionBackwardData operation accepts diff_dst, weights and optional dst shape as inputs, and compute the diff_src.

If auto_pad attribute is specified to one of valid, same_upper and same_lower, pads_begin and pads_end attributes will be ignored. The paddings will be calculated by following the below formula:

Let the parameters be:

Parameter

Depth

Height

Width

Comment

Paddings: Front, top, and left

PDL

PHL

PWL

In the attributes we use pads_begin to indicate the corresponding vector of paddings

Padding: Back, bottom, and right

PDR

PHR

PWR

In the attributes we use pads_end to indicate the corresponding vector of paddings

Stride

SD

SH

SW

In the attributes we use strides to indicate the corresponding vector of strides

Dilation

DD

DH

DW

In the attributes we use dilations to indicate the corresponding vector of dilations

Firstly, total_padding is calculated according to src_shape and dst_shape. Let src_h be height dimension of src_shape and dst_h be height dimension of dst_shape.

total_paddingh=SH×(srch1)+((KH1)×DH+1)dsth+output_paddingh

If auto_pad attribute is specified as valid:

PDL=0PDR=0

If auto_pad attribute is specified as same_lower:

PDL=floor(total_padding/2)PDR=total_paddingPDL

If auto_pad attribute is specified as same_upper:

PDL=total_paddingPDRPDR=floor(total_padding/2)

where:

  • dst_shape is either an attribute or an input tensor,

  • output_padding is an optional attribute.

Operation Attributes#

Attribute

Name

Description

Value Type

Supported

Values

Required or

Optional

strides

Controls the strides the weights tensor is moved when computing convolution

s64

A s64 list containing positive values

Required

pads_begin

Controls number of zeros to be add to the front/top/left of spatial dimensions, the attribute will be ignored when auto_pad attribute is specified to same_upper, same_lower or valid

s64

A s64 list containing non-negative values

Required

pads_end

Controls number of zeros to be add to the back/bottom/right of spatial dimensions, the attribute will be ignored when auto_pad attribute is specified to same_upper, same_lower or valid

s64

A s64 list containing non-negative values

Required

dilations

Controls the amount of stretching the kernel before convolution

s64

A s64 list containing positive values (>1 means dilated convolution)

Required

auto_pad

Controls how the padding is calculated

string

none (default), same_upper, same_lower, valid

Optional

output_padding

Adds additional amount of padding per each spatial axis in dst

s64

A s64 list containing non-negative

values, all zeros by default

Optional

groups

Controls how input channels and output channels are divided into

s64

A positive s64 value, 1 by default

Optional

data_format

Controls how to interpret the shape of src and dst.

string

NCX, NXC (default)

Optional

weights_format

Controls how to interpret the shape of weights

string

OIX, XIO (default)

Optional

dst_shape

Denotes the shape of the dst tensor

s64

A s64 list containing positive values

Optional

Execution Arguments#

The inputs and outputs must be provided according to the below index order when constructing an operation.

Inputs#

Index

Argument Name

Required or Optional

0

diff_dst

Required

1

weights

Required

2

dst_shape

Optional

@note The shape of weights is (out_channels,in_channels/groups,spatial_shape) for OIX format or (spatial_shape,in_channels/groups,out_channels) for XIO format. Both in_channels and out_channels must be divisible by groups attribute.

@note Either dst_shape input or dst_shape attribute should be provided. If both provided, dst_shape input will precede over dst_shape attribute.

Outputs#

Index

Argument Name

Required or Optional

0

diff_src

Required

Supported Data Types#

ConvolutionBackwardData operation supports the following data type combinations.

Diff_dst

Weights

Diff_src

Dst_shape

f32

f32

f32

s32

bf16

bf16

bf16

s32

f16

f16

f16

s32