GridSample
Description
Uses a given input tensor x and an input tensor grid, and pads the specified position in the grid with the value of the corresponding position in x based on the coordinate information provided by each position in the grid to obtain the final output tensor y.
Input
- x: 4D tensor of type float16 or float32, with shape [batch, channels, height_in, width_in]. Non-contiguous tensors are supported. The data format is ND.
- grid: 4D tensor of type float16 or float32, with shape [batch, height_out, width_out, 2]. Non-contiguous tensors are supported. The data format is ND.
Attribute
- interpolation_mode: string, specifying the optional character string of the interpolation method. The value 0 indicates bilinear interpolation, 1 indicates nearest interpolation, and 2 indicates bicubic interpolation. Currently, only bilinear and nearest are supported. The default value is 0.
- padding_mode: string, specifying the padding mode. When the value of (x, y) exceeds the sampling range of the input feature map, a specific value is returned. The value can be 0 (zeros), 1 (border), or 2 (reflection).
- align_corners: bool. The default value is 0. If the value is true, the corner pixels of the input and output tensors are aligned. The default value is false.
Output
y: 4D tensor with shape [batch, channels, height_out, width_out]. The data type is the same as that of x. Non-contiguous tensors are supported. The data format can be ND and the data type can be float16 or float32.
Constraints
None.
ONNX Opset Support
Opset v16
Parent topic: Supported ONNX Operators