code: def spatial_transformer_sampler(x, grid, **kwargs):
      """2D Spatial Transformer sampler.
  
      This is a differentiable image sampler. With a set of sampling points
      ``grid`` and an input feature map ``x``, this produces a sampled output
      feature map.
  
      This function currently only supports bilinear interpolation as a sampling
      kernel.
  
      When coordinates in ``grid`` is outside range :math:`[-1, 1]`, values are
      sampled from a zero padded input image.
  
      Notation: here is a notation for dimensionalities.
  
      - :math:`n` is the batch size.
      - :math:`c_I` is the number of the input channels.
      - :math:`h` and :math:`w` are the height and width of the input image,
        respectively.
      - :math:`h_O` and :math:`w_O` are the height and width of the output
        image.
  
      See detail in the following paper: `Spatial Transformer Networks
      <https://arxiv.org/abs/1506.02025>`_.
  
      .. note::
  
          cuDNN supports SpatialTransformerSampler from version 5.0.0.
  
      Args:
          x (:class:`~chainer.Variable` or :ref:`ndarray`):
              Input variable of shape :math:`(n, c_I, h, w)`.
          grid (~chainer.Variable): Coordinate variable of shape
              :math:`(n, 2, h_O, w_O)`. Each coordinate defines the spatial
              location in the input where a sampling kernel is applied to get
              the value at a particular pixel in the output.
              ``grid[idx, :, i, j]`` corresponds to the coordinate that is used
              to sample the values for an output pixel at location
              :math:`(i, j)`.
  
              In the second dimension, the first coordinate corresponds to the
              location along the horizontal axis, and the second coordinate
              corresponds to the location along the vertical axis.
  
              The coordinate :math:`(-1, -1)` corresponds to the upper-left
              corner of the input image.
  
      Returns:
          ~chainer.Variable: Output feature map of shape \
              :math:`(n, c_I, h_O, w_O)`.
  
      """
      if kwargs:
          argument.check_unexpected_kwargs(
              kwargs,
              use_cudnn='The argument "use_cudnn" is not '
              "supported anymore. "
              "Use chainer.using_config('use_cudnn', value) "
              "context where value can be `always`, `never`, or `auto`.",
          )
          argument.assert_kwargs_empty(kwargs)
      return SpatialTransformerSampler()(x, grid)
  
file_path: chainer/chainer/functions/array/spatial_transformer_sampler.py
imports: import numpy
  import chainer
  from chainer import backend
  from chainer.backends import cuda
  from chainer import function
  from chainer.utils import argument
  from chainer.utils import type_check
label_desc: Use image node_id 1 for calling a global function with example usage: spatial_transformer_sampler(x, grid) and returns: SpatialTransformerSampler