code: def forward_gpu(self, inputs):
      if not chainer.should_use_cudnn(">=auto", 5000):
          return self._forward(inputs)
      (theta,) = inputs
      B, _, _ = theta.shape
      H, W = self.output_shape
      grid_t = cuda.cupy.empty((B, H, W, 2), dtype=theta.dtype)
  
      # Unlike spatial_transformer_sampler,
      # channel size can be anything in this case.
      shape = numpy.array((B, 1, H, W), dtype=numpy.int32)
      theta = cuda.cupy.ascontiguousarray(theta)
      handle = cudnn.get_handle()
      self.st_desc = (
          cuda.cupy.cudnn.create_spatial_transformer_descriptor(
              _sampler_type, grid_t.dtype, len(shape), shape.ctypes.data
          )
      )
  
      libcudnn.spatialTfGridGeneratorForward(
          handle, self.st_desc.value, theta.data.ptr, grid_t.data.ptr
      )
      grid = cuda.cupy.transpose(grid_t, (0, 3, 1, 2))
  
      return (grid,)
  
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 4 for calling the SpatialTransformerGrid obj's underlying member method code with example usage: obj.forward_gpu(inputs) and returns: grid, self