[object Object][object Object][object Object]undefined
[object Object]
  • Description: Computes the backward pass of a convolution operation. Based on the output mask settings, it selectively computes gradients for the input, weight, and bias. This function supports 1D, 2D, and 3D convolutions.

  • Formula:

    The relationship between the input tensor (input(N,Cin,Din,Hin,WinN,C_{in},D_{in},H_{in},W_{in})), output tensor (out(N,Cout,Dout,Hout,WoutN,C_{out},D_{out},H_{out},W_{out})), stride (stridestride), kernel size (kernelSize,kD,kH,kWkernelSize,kD,kH,kW), and dilation (dilationdilation) is:

    Dout=Din+2padding[0]dilation[0](kernelSize[0]1)1stride[0]+1D_{out}=\lfloor \frac{D_{in}+2*padding[0]-dilation[0] * (kernelSize[0] - 1) - 1}{stride[0]}+1 \rfloor Hout=Hin+2padding[1]dilation[1](kernelSize[1]1)1stride[1]+1H_{out}=\lfloor \frac{H_{in}+2*padding[1]-dilation[1] * (kernelSize[1] - 1) - 1}{stride[1]}+1 \rfloor Wout=Win+2padding[2]dilation[2](kernelSize[2]1)1stride[2]+1W_{out}=\lfloor \frac{W_{in}+2*padding[2]-dilation[2] * (kernelSize[2] -1) -1}{stride[2]}+1 \rfloor

    The backpropagation of convolution needs to calculate the gradients of the input tensor xx (corresponding to the input in the function prototype), weight tensor ww (corresponding to the weight in the function prototype), and bias bb in the forward propagation of convolution.

    • Gradient with respect to xx, Lx\frac{\partial L}{\partial x} (corresponding to the gradInput parameter in the function prototype):

      Lxn,cin,i,j=cout=1Coutp=1kHq=1kWLyn,cout,ip,jqwcout,cin,p,q\frac{\partial L}{\partial x_{n, c_{in}, i, j}} = \sum_{c_{out}=1}^{C_{out}} \sum_{p=1}^{k_H} \sum_{q=1}^{k_W} \frac{\partial L}{\partial y_{n, c_{out}, i-p, j-q}}\cdot w_{c_{out}, c_{in}, p, q}

      Where LL is the loss function and Ly\frac{\partial L}{\partial y} is the gradient of the loss LL with respect to the output tensor yy (corresponding to the gradOutput parameter in the function prototype).

    • Gradient with respect to ww, Lw\frac{\partial L}{\partial w} (corresponding to the gradWeight parameter in the function prototype):

      Lwcout,cin,p,q=n=1Ni=1Houtj=1Woutxn,cin,isH+p,jsW+qLyn,cout,i,j\frac{\partial L}{\partial w_{c_{out}, c_{in}, p, q}} = \sum_{n=1}^{N} \sum_{i=1}^{H_{out}} \sum_{j=1}^{W_{out}} x_{n, c_{in}, i \cdot s_H + p, j \cdot s_W + q} \cdot \frac{\partial L}{\partial y_{n, c_{out}, i, j}}
    • Gradient with respect to bb, Lb\frac{\partial L}{\partial b} (corresponding to the gradBias parameter in the function prototype):

      Lbcout=n=1Ni=1Houtj=1WoutLyn,cout,i,j\frac{\partial L}{\partial b_{c_{out}}} = \sum_{n=1}^{N} \sum_{i=1}^{H_{out}} \sum_{j=1}^{W_{out}} \frac{\partial L}{\partial y_{n, c_{out}, i, j}}
[object Object]

Each operator has calls. First, aclnnConvolutionBackwardGetWorkspaceSize is called to obtain the workspace size required for computation and the executor that contains the operator computation flow. Then, aclnnConvolutionBackward is called to perform computation.

[object Object]
[object Object]
[object Object]
  • Parameters

    [object Object]
  • Returns

    [object Object]: status code. For details, see .

    The first-phase API implements input parameter verification. The following errors may be thrown.

    [object Object][object Object][object Object]
[object Object]
  • Parameters

    [object Object]
  • Returns

    [object Object]: status code. For details, see .

[object Object]
  • Deterministic computation:
    • aclnnConvolutionBackward is non-deterministic by default. Deterministic mode can be enabled via aclrtCtxSetSysParamOpt.
[object Object][object Object]
  • Formula 1:(inputdim+paddim×2)((weightdim1)×dilationdim+1)(input_{dim} + pad_{dim} \times 2) \ge ((weight_{dim} - 1) \times dilation_{dim} + 1)

Due to hardware resource limitations, the operator may fail for certain parameter combinations. Analyze the error logs to diagnose the issue. If the error persists, click to obtain technical support.

[object Object]

The following example is for reference only. For details, see .

[object Object]