Skip to content
fn

grid_sample_op

→TensorImplPtr
int grid_sample_op(const int & input, const int & grid, int mode, int padding_mode, bool align_corners)

Python wrappers

Public Python APIs implemented by this engine symbol.

Public grid-sample entry point.

Thin wrapper that delegates to GridSampleBackward::forward.

Parameters

inputTensorImplPtr
4-D input image (N, C, H_in, W_in).
gridTensorImplPtr
Sampling grid (N, H_out, W_out, 2) with coordinates in [−1,1][-1, 1].
modeint
Interpolation kernel code (0/1 for bilinear/nearest).
padding_modeint
Out-of-bounds policy code (0/1 for zeros/border).
align_cornersbool
Coordinate mapping mode.

Returns

TensorImplPtr

Resampled tensor of shape (N, C, H_out, W_out).