[object Object]

[object Object][object Object]undefined
[object Object]
  • Function: Performs backpropagation of .

  • 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 3D interpolation point (N, C, D, H, W), the following formula is used:

      scale_d={(inputSize[2]1)/(outputSize[0]1)alignCorners=true1/scales_dalignCorners=false&scales_d>0inputSize[2]/outputSize[0]alignCorners=falsescale\_d =\begin{cases} (inputSize[2]-1) / (outputSize[0]-1) & alignCorners=true \\ 1 / scales\_d & alignCorners=false\&scales\_d>0\\ inputSize[2] / outputSize[0] & alignCorners=false \end{cases} scale_h={(inputSize[3]1)/(outputSize[1]1)alignCorners=true1/scales_halignCorners=false&scales_h>0inputSize[3]/outputSize[1]alignCorners=falsescale\_h =\begin{cases} (inputSize[3]-1) / (outputSize[1]-1) & alignCorners=true \\ 1 / scales\_h & alignCorners=false\&scales\_h>0\\ inputSize[3] / outputSize[1] & alignCorners=false \end{cases} scale_w={(inputSize[4]1)/(outputSize[2]1)alignCorners=true1/scales_walignCorners=false&scales_w>0inputSize[4]/outputSize[2]alignCorners=falsescale\_w =\begin{cases} (inputSize[4]-1) / (outputSize[2]-1) & alignCorners=true \\ 1 / scales\_w & alignCorners=false\&scales\_w>0\\ inputSize[4] / outputSize[2] & alignCorners=false \end{cases}

      Therefore, for a point p (x, y, z) in a direction of the output, a point mapped back to the source image is denoted as q (x', y', z'). Then:

      x={xscale_dalignCorners=trueMAX(0,(x+0.5)scale_d0.5)alignCorners=falsex' =\begin{cases} x * scale\_d & alignCorners=true \\ MAX(0,{(x+0.5)*scale\_d-0.5}) & alignCorners=false \end{cases} y={yscale_halignCorners=trueMAX(0,(y+0.5)scale_h0.5)alignCorners=falsey' =\begin{cases} y * scale\_h & alignCorners=true \\ MAX(0,{(y+0.5)*scale\_h-0.5}) & alignCorners=false \end{cases} z={zscale_walignCorners=trueMAX(0,(z+0.5)scale_w0.5)alignCorners=falsez' =\begin{cases} z * scale\_w & alignCorners=true \\ MAX(0,{(z+0.5)*scale\_w-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} z0=int(z),z1=int(z)+1,lambdc0=z1z,lambdc1=1lambdc0z_{0} =int(z'),z_{1} =int(z')+1, lambdc_{0} = z_{1}-z', lambdc_{1} = 1-lambdc_{0}
      • Then:

        V(px,y,z)=V(px0,y0,z0)lambda0lambdb0lambdc0+V(px0,y0,z1)lambda0lambdb0lambdc1+V(px0,y1,z0)lambda0lambdb1lambdc0+V(px0,y1,z1)lambda0lambdb1lambdc1+V(px1,y0,z0)lambda1lambdb0lambdc0+V(px1,y0,z1)lambda1lambdb0lambdc1+V(px1,y1,z0)lambda1lambdb1lambdc0+V(px1,y1,z1)lambda1lambdb1lambdc1{V(p_{x, y, z})} = {V(p_{x0, y0, z0})} * {lambda_{0}} * {lambdb_{0}} * {lambdc_{0}} + {V(p_{x0, y0, z1})} * {lambda_{0}} * {lambdb_{0}} * {lambdc_{1}} + {V(p_{x0, y1, z0})} * {lambda_{0}} * {lambdb_{1}} * {lambdc_{0}} + {V(p_{x0, y1, z1})} * {lambda_{0}} * {lambdb_{1}} * {lambdc_{1}} + {V(p_{x1, y0, z0})} * {lambda_{1}} * {lambdb_{0}} * {lambdc_{0}} + {V(p_{x1, y0, z1})} * {lambda_{1}} * {lambdb_{0}} * {lambdc_{1}} + {V(p_{x1, y1, z0})} * {lambda_{1}} * {lambdb_{1}} * {lambdc_{0}} + {V(p_{x1, y1, z1})} * {lambda_{1}} * {lambdb_{1}} * {lambdc_{1}}
      • Assume that the output image out (x,y,z)(x, y, z) for forward interpolation is affected by the original image input (xi,yj,zk)(x_i, y_j, z_k). Then:

        gradInput(xi,yj,zk)+=gradOut(x,y,z)lambda(xi,yj,zk)lambdb(xi,yj,zk)lambdc(xi,yj,zk)gradInput(x_i,y_j,z_k) += gradOut(x,y,z) * lambda(x_i,y_j,z_k)* lambdb(x_i,y_j,z_k)* lambdc(x_i,y_j,z_k)
[object Object]

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

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

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

      The data types of gradOut and gradInput 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 gradInput are as follows:

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

    • The N and C axes of gradInput 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:

      NC(gradOut_DgradOut_HgradOut_W+gradInput_DgradInput_HgradInput_W+gradOut_DgradOut_HgradInput_W+gradOut_DgradInput_HgradInput_W)sizeof(float)<60102410241024N * C * (gradOut\_D * gradOut\_H * gradOut\_W + gradInput\_D * gradInput\_H * gradInput\_W + gradOut\_D * gradOut\_H * gradInput\_W + gradOut\_D * gradInput\_H * gradInput\_W) * 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_D * gradOut_H < 2^31

    • gradInput_W * gradInput_H < 2^31

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

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

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

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

[object Object]