[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.

  • Formulas:

    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 interpolationMode does not support interpolation mode 2 (bicubic interpolation).
      • The data types of input, grid, and out do not support BFLOAT16.
    • [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 interpolationMode supports interpolation mode 2 (bicubic interpolation) only when the input data type is FLOAT32 or FLOAT16.
      • The data types of input, grid, and out do not support BFLOAT16.
    • [object Object]Atlas 200I/500 A2 inference products[object Object]

      When the API runs on the AI Core, the following conditions must be met:

      • The input parameter interpolationMode is bilinear.
      • The input parameter paddingMode is zeros.
      • The data type of the input, grid, and out parameters is FLOAT16.
      • The shape of the input parameter must meet the following requirement: The value of the C dimension is 32.
    • [object Object]Atlas inference products[object Object]

      When the API runs on the AI Core, the following conditions must be met:

      • The value of interpolationMode is bilinear.
      • The value of paddingMode is zeros.
      • The data type of the input, grid, and out parameters is FLOAT16.
      • The shape of the input parameter must meet the following requirement: The value of the C dimension is 32 or the value of CHW is less than 20480.
      • The data format of the input parameter does not support NHWC.
  • 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 data formats of input, grid, and out 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 input is less than the maximum value of INT32.
  • If the product of the grid input value and the image size (width or height) is greater than the 24-bit binary number (16777216), the sampling point may have an error 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 computation:
    • aclnnGridSampler2D defaults to a deterministic implementation.
[object Object]

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

[object Object]