[object Object]

[object Object][object Object]undefined
[object Object]
  • API description: Performs backpropagation of .

    • [object Object]Atlas A2 training products/Atlas A2 inference products[object Object] and [object Object]Atlas A3 training products/Atlas A3 inference products[object Object]: Compared with , this API supports scale computation and adds constraints on outputSize and scale. You should select a proper API based on the actual situation.
    • [object Object]Atlas training products[object Object] and [object Object]Atlas inference products[object Object]: This API is the same as .
  • Formula:

    • Core forward algorithm logic:
      1. Scale the destination image to the same size as the source image.
      2. Calculate points of the scaled destination image and points of adjacent source images.
      3. Calculate the weights from the adjacent points to the target points, and multiply and accumulate the weights to obtain the target point values.
    • Calculation logic: An image can be scaled by corner alignment (that is, based on the center point of the pixels in the upper left corner of the source image) or edge alignment (that is, based on the vertex in the upper left corner and two edges of the source image). The two modes differ in the scaling factor and coordinates. Then:scaleH={(inputSize[2]1)/(outputSize[0]1)alignCorners=true1/scalesHalignCorners=false&scalesH>0inputSize[2]/outputSize[0]alignCorners=falsescaleH =\begin{cases} (inputSize[2]-1) / (outputSize[0]-1) & alignCorners=true \\ 1 / scalesH & alignCorners=false\&scalesH>0\\ inputSize[2] / outputSize[0] & alignCorners=false \end{cases} scaleW={(inputSize[3]1)/(outputSize[1]1)alignCorners=true1/scalesWalignCorners=false&scalesW>0inputSize[3]/outputSize[1]alignCorners=falsescaleW =\begin{cases} (inputSize[3]-1) / (outputSize[1]-1) & alignCorners=true \\ 1 / scalesW & alignCorners=false\&scalesW>0\\ inputSize[3] / outputSize[1] & alignCorners=false \end{cases} Therefore, for a point p (x, y) in a direction of the output, a point mapped back to the source image is denoted as q (x', y'). Then:x={xscaleHalignCorners=trueMAX(0,(x+0.5)scaleH0.5)alignCorners=falsex' =\begin{cases} x * scaleH & alignCorners=true \\ MAX(0,{(x+0.5)*scaleH-0.5}) & alignCorners=false \end{cases} y={yscaleWalignCorners=trueMAX(0,(y+0.5)scaleW0.5)alignCorners=falsey' =\begin{cases} y * scaleW & alignCorners=true \\ MAX(0,{(y+0.5)*scaleW-0.5}) & alignCorners=false \end{cases}
      • Denoted:

        x0=int(x),x1=int(x)+1,lambda0=x1x,lambda1=1lambda0x_{0} =int(x'),x_{1} =int(x')+1, lambda_{0} = x_{1}-x', lambda_{1} = 1-lambda_{0} y0=int(y),y1=int(y)+1,lambdb0=y1y,lambdb1=1lambdb0y_{0} =int(y'),y_{1} =int(y')+1, lambdb_{0} = y_{1}-y', lambdb_{1} = 1-lambdb_{0}
      • Then:

        V(px,y)=V(px0,y0)lambda0lambdb0+V(px0,y1)lambda0lambdb1+V(px1,y0)lambda1lambdb0+V(px1,y1)lambda1lambdb1{V(p_{x, y})} = {V(p_{x0, y0})} * {lambda_{0}} * {lambdb_{0}} + {V(p_{x0, y1})} * {lambda_{0}} * {lambdb_{1}} + {V(p_{x1, y0})} * {lambda_{1}} * {lambdb_{0}} + {V(p_{x1, y1})} * {lambda_{1}} * {lambdb_{1}}
      • Assume that the output image out (x,y)(x, y) for forward interpolation is affected by the original image input (xi,yj)(x_i, y_j). Then:

        gradInput(xi,yj)+=gradOutput(x,y)lambd(xi,yj)gradInput(x_i,y_j) += gradOutput(x,y) * lambd(x_i,y_j)
[object Object]

Each operator has calls. First, aclnnUpsampleBilinear2dBackwardV2GetWorkspaceSize is called to obtain the workspace size required for computation and the executor that contains the operator computation process. Then, aclnnUpsampleBilinear2dBackwardV2 is called to perform computation.

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

    [object Object]
    • [object Object]Atlas training products[object Object] and [object Object]Atlas inference products[object Object]:

      The data types of [object Object] and [object Object] do not support BFLOAT16.

  • Returns

    aclnnStatus: status code. For details, see .

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

    [object Object]
[object Object]
  • Parameters:

    [object Object]
  • Returns:

    aclnnStatus: status code. For details, see .

[object Object]
  • The shape constraints of [object Object] and [object Object] are as follows:
    • The value of each dimension is less than or equal to 2^20.

    • The N and C axes of [object Object] must be the same as those of [object Object].

    • The memory usage must be less than 60 GB. The memory size can be calculated according to the following formula:

      (gradOut_HgradOut_W+out_Hout_W+gradOut_Hout_W)NCsizeof(float)<60102410241024(gradOut\_H * gradOut\_W + out\_H * out\_W + gradOut\_H * out\_W) * N * C * sizeof(float) < 60 * 1024 * 1024 * 1024

      Where,

      • N indicates the N axis of the input and output.
      • C indicates the C axis of the input and output.
    • N * C * gradOut_H < 2^31

  • Either the H and W axes of the outputSize parameter or the scalesH and scalesW parameters can be used.
    • When alignCorners is set to True:
      • If the value of the corresponding axis of outputSize is equal to 1, the value of the corresponding axis of scales is 0.
      • In other cases, the values of the corresponding axes in the input parameters inputSize and outputSize are used, and scales=(inputSize1)/(outputSize1)scales = (inputSize – 1)/(outputSize – 1).
    • If alignCorners is set to False:
      • If the value of scalesH or scalesW is less than or equal to 0, the value of the corresponding axis in outputSize is used, that is, scales=(inputSize/outputSize)scales = (inputSize/outputSize).
      • If the value of scalesH or scalesW is greater than 0, the value of scalesH or scalesW is used. That is, the value of the corresponding axis of outputSize is floor(inputSize_HscalesH)floor(inputSize\_H * scalesH) or floor(inputSize_WscalesW)floor(inputSize\_W * scalesW).
  • Deterministic computing:
    • aclnnUpsampleBilinear2dBackwardV2 defaults to a deterministic implementation.
[object Object]

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

[object Object]