[object Object]

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

  • Formulas:

    • Core forward algorithm logic:
      1. Map each point of the target image back to the original image to obtain a coordinate with a decimal point.
      2. Based on the floating-point coordinate, calculate the adjacent points of the original image.
      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:scale={(inputSize[2]1)/(outputSize[0]1)alignCorners=true1/scalesalignCorners=false&scales>0inputSize[2]/outputSize[0]alignCorners=falsescale =\begin{cases} (inputSize[2]-1) / (outputSize[0]-1) & alignCorners=true \\ 1 / scales & alignCorners=false\&scales>0\\ inputSize[2] / outputSize[0] & 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={xscalealignCorners=trueMAX(0,(x+0.5)scale0.5)alignCorners=falsex' =\begin{cases} x * scale & alignCorners=true \\ MAX(0,{(x+0.5)*scale-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}
      • Then:

        V(px)=V(px0)lambda0+V(px1)lambda1{V(p_{x})} = {V(p_{x0})} * {lambda_{0}} + {V(p_{x1})} * {lambda_{1}}
      • Assume that the output image out (x)(x) for forward interpolation is affected by the original image input (xi)(x_i). Then:

        gradInput(xi)+=gradOut(x)lambda(xi)gradInput(x_i) += gradOut(x) * lambda(x_i)
[object Object]

Each operator has calls. First, aclnnUpsampleLinear1dBackwardGetWorkspaceSize is called to obtain the workspace size required for computation and the executor that contains the operator computation process. Then, aclnnUpsampleLinear1dBackward 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 the input parameter gradOut and output parameter out must be FLOAT32 or FLOAT16.

    • [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]:

      Input gradOut: When the value of the axis corresponding to gradOut is different from that of the axis corresponding to inputSize, the data type can only be FLOAT32 or FLOAT16.

  • 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_L+out_L+out_L)NCsizeof(dtype)<60102410241024(gradOut\_L + out\_L + out\_L) * N * C * sizeof(dtype) < 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 < 2^31

  • If the data formats of the input parameter gradOut and output parameter out are not NCL or ND, the input data is processed as NCL format by default.

  • [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]: The upscaling factor for input data must be less than or equal to 500.

    outputSize[0]/LengthoftheoutputshapeL<=500outputSize[0] / Length of the output shape L <= 500
  • The inputSize, outputSize, and scales parameters must meet the following requirements:

    outputSize=floor(inputSize_Lscales)outputSize = floor(inputSize\_L * scales)
  • Deterministic computation:

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

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

[object Object]