code: def _offset2grid(offset, kh, kw, sy, sx, ph, pw, h, w):
      n, khkw2, out_h, out_w = offset.shape
      khkw = int(khkw2 / 2)
      xp = backend.get_array_module(offset)
  
      ys, xs = xp.meshgrid(
          xp.arange(0, sy * out_h, sy, dtype=numpy.float32),
          xp.arange(0, sx * out_w, sx, dtype=numpy.float32),
          indexing="ij",
          copy=False,
      )
      filter_offset_x = xp.tile(xp.arange(kw, dtype=numpy.float32), kh)
      filter_offset_y = xp.repeat(
          xp.arange(kh, dtype=numpy.float32), kw
      )
      x_coord = (
          offset[:, :khkw]
          + xs[None, None]
          + filter_offset_x[None, :, None, None]
      )
      y_coord = (
          offset[:, khkw:]
          + ys[None, None]
          + filter_offset_y[None, :, None, None]
      )
  
      # The values of this variable is clipped in range [-1, 1].
      # The coordinate (-1, -1) corresponds to the upper-left
      # corner of the input image.
      x_coord = (x_coord / (w + 2 * pw - 1) - 0.5) * 2
      y_coord = (y_coord / (h + 2 * ph - 1) - 0.5) * 2
  
      # Shape of `coord` is (n, 2 * kh * kw, out_h, out_w)
      coord = concat.concat([x_coord, y_coord], axis=1)
      return coord
  
file_path: chainer/chainer/functions/connection/deformable_convolution_2d_sampler.py
imports: import numpy
  from chainer import backend
  from chainer.functions.array import broadcast
  from chainer.functions.array import concat
  from chainer.functions.array import pad
  from chainer.functions.array import spatial_transformer_sampler
  from chainer.functions.math import matmul
label_desc: Use image node_id 2 for calling a global function with example usage: _offset2grid(offset, kh, kw, sy, sx, ph, pw, h, w) and returns: coord