code: def spatial_transformer_grid(theta, output_shape, **kwargs):
      """2D Spatial Transformer grid.
  
      This function generates coordinates of the points sampled from an image
      to perform warping described in `Spatial Transformer Networks
      <https://arxiv.org/abs/1506.02025>`_.
  
      Given a coordinate in the warped image :math:`(x_i^t, y_i^t)`, the point
      sampled from the source image :math:`(x_i^s, y_i^s)` are calculated
      by the following equation.
  
      .. note::
  
          cuDNN supports SpatialTransformerGrid from version 5.0.0.
  
      .. math::
  
          \\left(\\begin{matrix} x_i^s \\\\
              y_i^s \\end{matrix}\\right)
          =
          \\left(\\begin{matrix} \\theta_{11} & \\theta_{12} & \\theta_{13} \\\\
              \\theta_{21} & \\theta_{22} & \\theta_{23} \\end{matrix}\\right)
          \\left(\\begin{matrix} x_i^t \\\\
              y_i^t \\\\
              1 \\end{matrix}\\right)
  
      Notation: here is a notation for dimensionalities.
  
      - :math:`n` is the batch size.
      - :math:`h_O` and :math:`w_O` are the height and the width of the output
        image.
  
      Args:
          theta (:class:`~chainer.Variable` or :ref:`ndarray`):
              An array of shape :math:`(n, 2, 3)`.
              This is a batch of :math:`2 \\times 3` matrix used for
              the warping described above.
          output_shape (tuple): A tuple of 2 elements: :math:`h_O, w_O`.
  
      Returns:
          ~chainer.Variable:  A variable of shape :math:`(n, 2, h_O, w_O)`.
          In the 2nd dimension, the first element is the coordinate along the
          x axis, and the second element is the coordinate along the y axis.
          All the coordinates in the image are scaled to fit range
          :math:`[-1, 1]`.
          This means that the coordinate :math:`(-1, -1)` corresponds to
          the upper-left corner of the input image.
  
      """
      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 SpatialTransformerGrid(output_shape)(theta)
  
file_path: chainer/chainer/functions/array/spatial_transformer_grid.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_grid(theta, output_shape) and returns: SpatialTransformerGrid