[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], [object Object]Atlas A3 training products/Atlas A3 inference products[object Object], and Ascend 950PR/Ascend 950DT: Compared with , this API supports scale-based computation and adds constraints on outputSize and scale. Select a proper API based on your requirements.
    • [object Object]Atlas training products[object Object] and [object Object]Atlas inference products[object Object]: This API is the same as .
  • Formulas:

    • Core forward algorithm logic:
      1. Each point in the target image is mapped back to the original image to obtain a coordinate with a decimal point.
      2. Based on the floating-point coordinate, the points of the original image before and after the target point are calculated.
      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. For a two-dimensional interpolation point (N, C, H, W), the following formula is used: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)lambda(xi,yj)lambdb(xi,yj)gradInput(x_i,y_j) += gradOutput(x,y) * lambda(x_i,y_j) * lambdb(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 gradOut and out do not support BFLOAT16.

  • Returns:

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

    The first-phase API implements input parameter validation. The following error codes may be returned.

    [object Object]
[object Object]
  • Parameters

    [object Object]
  • Returns:

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

[object Object]
  • The shape constraints of gradOut and out are as follows:

    • The value of each dimension is less than or equal to 2^20.

    • The N and C axes of out must be the same as those of gradOut.

    • 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

      The values are as follows:

      • 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

  • The inputSize, outputSize, scalesH, and scalesW parameters must meet the following requirements:

    outputSize_H=floor(inputSize_HscalesH)outputSize\_H = floor(inputSize\_H * scalesH) outputSize_W=floor(inputSize_WscalesW)outputSize\_W = floor(inputSize\_W * scalesW)
  • Deterministic computation:

    • aclnnUpsampleBilinear2dBackwardV2 defaults to a deterministic implementation.
[object Object]

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

[object Object]