GridSample

Description

This operation samples the input x through interpolation based on the flow field grid, which is usually generated by affine_grid. The grid with the shape [N,H,W,2] is the coordinates of (x,y) and the shape [N,H,W], where x is the fourth dimension of the index (in the width dimension). The input data x and y are indexed to the third dimension. (in the height dimension). The final result is the interpolation values of the four nearest corner points. The shape of the output tensor is [N, C, H, W].

Input

Two inputs:

x: 4D Tensor of type float16 or float32, with the shape of [batch, channels, height, width].

grid: 4D Tensor of type float16 or float32, with shape [batch, height, width, 2].

Output

One output:

y: 4D tensor of type float16 or float32.

Property

interpolation_mode: specifies the optional character string of the interpolation method. Currently, only bilinear and nearest are supported. The data type is string.

padding_mode: optional character string that specifies the padding method. Data type: string.

align_corners: an optional bool. If the value is true, the corner pixel centers of the input and output tensors are aligned. The default value is false and the data type is bool.

ONNX Opset Support

Opset v16