TensorPlay

Latest development documentation · Updated 2026-09-08. A documentation snapshot for package 1.0.0.dev20260909 is not available.

On this page

tensorplay.nn.functional.grid_sample

tensorplay.nn.functional.grid_sample(input: TensorBase, grid: TensorBase, mode: str = 'bilinear', padding_mode: str = 'zeros', align_corners=None) TensorBase[source]

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) – input of shape (N,C,Hin,Win)(N, C, H_\text{in}, W_\text{in}) (4-D case) or (N,C,Din,Hin,Win)(N, C, D_\text{in}, H_\text{in}, W_\text{in}) (5-D case)

  • grid (Tensor) – flow-field of shape (N,Hout,Wout,2)(N, H_\text{out}, W_\text{out}, 2) (4-D case) or (N,Dout,Hout,Wout,3)(N, D_\text{out}, H_\text{out}, W_\text{out}, 3) (5-D case)

  • mode (str) – 'bilinear' | 'nearest' | 'bicubic'. Default: 'bilinear'

  • padding_mode (str) – 'zeros' | 'border' | 'reflection'. Default: 'zeros'

  • align_corners (bool, optional) – extrema treatment, default False.

Dispatches to the native grid_sampler_2d / grid_sampler_3d kernels both input and grid.

Search documentation

Search all 1,743 documentation pages.

Keyboard shortcuts

Global

  • /Focus search
  • ?This dialog
  • ,Open settings
  • jAI assistant

Search

  • Navigate results
  • Open result
  • escClose

Package

  • mMain information
  • dDocs
  • .Code
  • -Changelog
  • tTimeline
  • sStats
  • vVersions