.. index:: pair: page; ConvolutionBackwardData .. _doxid-dev_guide_op_convolutionbackwarddata: ConvolutionBackwardData ======================= General ~~~~~~~ ConvolutionBackwardData operation accepts :math:`\diffdst`, :math:`\weights` and optional dst shape as inputs, and compute the :math:`\diffsrc`. 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 :math:`PD_L` :math:`PH_L` :math:`PW_L` In the attributes we use ``pads_begin`` to indicate the corresponding vector of paddings Padding: Back, bottom, and right :math:`PD_R` :math:`PH_R` :math:`PW_R` In the attributes we use ``pads_end`` to indicate the corresponding vector of paddings Stride :math:`SD` :math:`SH` :math:`SW` In the attributes we use ``strides`` to indicate the corresponding vector of strides Dilation :math:`DD` :math:`DH` :math:`DW` In the attributes we use ``dilations`` to indicate the corresponding vector of dilations ================================= ============= ============= ============= ========================================================================================= Firstly, :math:`total\_padding` is calculated according to :math:`src\_shape` and :math:`dst\_shape`. Let :math:`src\_h` be height dimension of :math:`src\_shape` and :math:`dst\_h` be height dimension of :math:`dst\_shape`. .. math:: total\_padding_h = SH \times (src\_h - 1) + ((KH -1 ) \times DH + 1) - dst\_h + output\_padding_h If ``auto_pad`` attribute is specified as ``valid`` : .. math:: PD_L = 0 \\ PD_R = 0 If ``auto_pad`` attribute is specified as ``same_lower`` : .. math:: PD_L = floor(total\_padding / 2) \\ PD_R = total\_padding - PD_L If ``auto_pad`` attribute is specified as ``same_upper`` : .. math:: PD_L = total\_padding - PD_R \\ PD_R = floor(total\_padding / 2) where: * :math:`dst\_shape` is either an attribute or an input tensor, * :math:`output\_padding` is an optional attribute. Operation attributes ~~~~~~~~~~~~~~~~~~~~ =========================================================================================================================== =============================================================================================================================================================================================== =========== ===================================================================== ===================== Attribute Name Description Value Type Supported Values Required or Optional =========================================================================================================================== =============================================================================================================================================================================================== =========== ===================================================================== ===================== :ref:`strides ` Controls the strides the weights tensor is moved when computing convolution s64 A s64 list containing positive values Required :ref:`pads_begin ` Controls number of zeros to be add to the front/top/left of spatial dimensions s64 A s64 list containing non-negative values Required :ref:`pads_end ` Controls number of zeros to be add to the back/bottom/right of spatial dimensions s64 A s64 list containing non-negative values Required :ref:`dilations ` Controls the amount of stretching the kernel before convolution ( `visualization link `__ ) s64 A s64 list containing positive values (>1 means dilated convolution) Required :ref:`auto_pad ` Controls how the padding is calculated string ``none`` (default), ``same_upper`` , ``same_lower`` , ``valid`` Optional :ref:`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 :ref:`groups ` Controls how input channels and output channels are divided into s64 A positive s64 value, ``1`` by default Optional :ref:`data_format ` Controls how to interpret the shape of ``src`` and ``dst`` . string ``NCX`` , ``NXC`` (default) Optional :ref:`weights_format ` Controls how to interpret the shape of ``weights`` . string ``OIX`` , ``XIO`` (default) Optional :ref:`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 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 :math:`\weights` is :math:`(out\_channels, in\_channels / groups, spatial\_shape)` for ``OIX`` format or :math:`(spatial\_shape, in\_channels / groups, out\_channels)` for ``XIO`` format. Both :math:`in\_channels` and :math:`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 ========= ======== ========= ==========