code: def check_forward(self, theta, output_shape):
      grid = functions.spatial_transformer_grid(
          theta, output_shape
      ).data
  
      theta = cuda.to_cpu(theta)
      B = theta.shape[0]
      H, W = output_shape
  
      expected = []
      for b in range(B):
          for i in numpy.linspace(-1.0, 1.0, H):
              for j in numpy.linspace(-1.0, 1.0, W):
                  coord = numpy.array([j, i, 1])
                  expected.append(self.theta[b].dot(coord))
      expected = (
          numpy.array(expected)
          .reshape(B, H, W, 2)
          .transpose(0, 3, 1, 2)
      )
      testing.assert_allclose(
          grid, expected, **self.check_forward_options
      )
      self.assertEqual(grid.dtype, self.dtype)
  
file_path: chainer/tests/chainer_tests/functions_tests/array_tests/test_spatial_transformer_grid.py
imports: import unittest
  import numpy
  import chainer
  from chainer.backends import cuda
  from chainer import functions
  from chainer import gradient_check
  from chainer import testing
  from chainer.testing import attr
label_desc: Use image node_id 2 for calling the TestSpatialTransformerGrid obj's underlying member method code with example usage: obj.check_forward(theta, output_shape) without return types