# tensorplay.nn.functional.grid_sample Source: https://www.tensorplay.cn/docs/generated/tensorplay.nn.functional.grid_sample.html ```python tensorplay.nn.functional.grid_sample(input: Tensor, grid: Tensor, mode: str = 'bilinear', padding_mode: str = 'zeros', align_corners=None) → Tensor ``` Compute grid sample. Given an input and a flow-field grid, computes the output using input values and pixel locations from grid. Currently, only spatial (4-D) and volumetric (5-D) input are supported. Parameters: - input ([Tensor](/docs/generated/tensorplay.Tensor.html#tensorplay.Tensor)) – input of shape $(N, C, H_\text{in}, W_\text{in})$ (4-D case) or $(N, C, D_\text{in}, H_\text{in}, W_\text{in})$ (5-D case) - grid ([Tensor](/docs/generated/tensorplay.Tensor.html#tensorplay.Tensor)) – flow-field of shape $(N, H_\text{out}, W_\text{out}, 2)$ (4-D case) or $(N, D_\text{out}, H_\text{out}, W_\text{out}, 3)$ (5-D case) - mode ([str](https://docs.python.org/3/builtins/stdtypes.html#str)) – 'bilinear' | 'nearest' | 'bicubic'. Default: 'bilinear' - padding_mode ([str](https://docs.python.org/3/builtins/stdtypes.html#str)) – 'zeros' | 'border' | 'reflection'. Default: 'zeros' - align_corners ([bool](https://docs.python.org/3/builtins/functions.html#bool), optional) – extrema treatment, default False. Dispatches to the native grid_sampler_2d / grid_sampler_3d kernels both input and grid.