[object Object]

[object Object][object Object]undefined
[object Object]
  • API description: Given an input tensor and a grid, computes the output using input values and pixel locations from grid.

  • Formula:

    The dimensions of input, grid, and output are as follows:

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

    input, grid, and output have the same N. C in input is the same as that in output. HoutH_{out} and WoutW_{out} in grid and output are the same. The size of 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=0: Use 0 for out-of-bound locations.
      • paddingMode=1: Use border values for out-of-bound locations.
      • paddingMode=2: Use symmetric values of the border values for out-of-bound locations.
    • During input sampling, the processing varies according to interpolationMode.

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

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

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

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

      The input parameter [object Object] does not support interpolation mode 2 (bicubic interpolation).

    • [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 input parameter [object Object] supports interpolation mode 2 (bicubic interpolation) only when the input data type is FLOAT32 or FLOAT16.

  • 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 data formats of [object Object], [object Object], and [object Object] can only be (N, C, H, W). If other data formats are input, the (N, C, H, W) format is used by default.
  • The (H axis × W axis) of the [object Object] is less than the maximum value of INT32.
  • If the input value of grid multiplied by the image length or width is greater than a 24-bit binary number (16777216), the sampling point and the precision may be inaccurate.
  • If grid contains a large amount of data beyond the range of [-1,1], lots of duplicate values will occur in the calculation result when zeros or border padding is used.
  • [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]:
    • If grid contains data beyond the range of [-1, 1], when bicubic interpolation is used, errors may occur in the calculation of data in a small value range, and the precision may be inaccurate.
    • When bilinear or bicubic interpolation is used, the workspace memory is required for the FLOAT16 data type.
  • [object Object]Atlas training products[object Object]: When bilinear interpolation is used, the workspace memory is required for the FLOAT16 data type.
  • Deterministic computing:
    • aclnnGridSampler2D defaults to a deterministic implementation.
[object Object]

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

[object Object]