[object Object]

[object Object][object Object]undefined
[object Object]
  • API description: Performs backpropagation of to compute the gradients of tensors input and grid.
  • Formula:
    • Computing process:

      1. The coordinates mapped to input are calculated based on the (x, y) values stored in grid. The coordinates are related to alignCorners and paddingMode.
      2. Based on the input interpolationMode, the bilinear or nearest interpolation mode is used to calculate the weight of the point around the coordinate allocated to the gradient.
      3. The final dx and dgrid results are calculated based on the gradient value stored in grad multiplied by the weight of the corresponding point.
    • Where, The dimensions of grad, input, grid, dx, and dgrid are as follows:

      grad:(N,C,Hout,Wout)input:(N,C,Hin,Win)grid:(N,Hout,Wout,2)dx:(N,C,Hin,Win)dgrid:(N,Hout,Wout,2)grad: (N, C, H_{out}, W_{out})\\ input: (N, C, H_{in}, W_{in})\\ grid: (N, H_{out}, W_{out}, 2)\\ dx: (N, C, H_{in}, W_{in})\\ dgrid: (N, H_{out}, W_{out}, 2)

      grad, input, grid, dx, and dgrid have the same N. grad, input, and dx have the same C. HinH_{in} and WinW_{in} in input and dx are the same. HoutH_{out} and WoutW_{out} in grad, grid, and dgrid are the same. The last dimension of grid is 2, indicating that the input pixel location is (x, y). The value ranges of x and y are normalized to [–1, 1]. (–1, 1) indicates the coordinates of the upper left corner, and (1, –1) indicates the coordinates of the lower right corner.

      • Out-of-bound coordinates are processed based on the padding mode.

        • paddingMode="zeros": Use 0 for out-of-bound locations.
        • paddingMode="border": Use border values for out-of-bound locations.
        • paddingMode="reflection": Use symmetric values of the border values for out-of-bound locations.
      • During input sampling, the processing varies according to interpolationMode.

        • interpolationMode="bilinear": Use the weighted average value of the 4 coordinates around (x, y) in the input.
        • interpolationMode="nearest": Use the nearest coordinates to (x, y) in the input.
[object Object]

Each operator has calls. First, aclnnGridSampler2DBackwardGetWorkspaceSize is called to obtain the workspace size required for computation and the executor that contains the operator computation process. Then, aclnnGridSampler2DBackward 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 [object Object], [object Object], [object Object], [object Object], and [object Object] do not support BFLOAT16 or DOUBLE.

  • 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]
  • Deterministic computing:
    • aclnnGridSampler2DBackward defaults to a non-deterministic implementation. You can call aclrtCtxSetSysParamOpt to enable deterministic computing. A deterministic implementation must meet the following conditions:
      • The input and output data types are not DOUBLE.
      • The C axes of the input and output are less than or equal to 2,048.
[object Object]

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

[object Object]