code: def compute_indices_and_weights(
      out_size, in_size, mode, align_corners, xp
  ):
      out_H, out_W = out_size
      H, W = in_size
      if mode == "bilinear":
          if align_corners:
              v = xp.linspace(0, H - 1, num=out_H, dtype=numpy.float)
              u = xp.linspace(0, W - 1, num=out_W, dtype=numpy.float)
          else:
              y_scale = H / out_H
              x_scale = W / out_W
              v = (
                  xp.arange(out_H, dtype=numpy.float) + 0.5
              ) * y_scale - 0.5
              v = xp.maximum(v, 0)
              u = (
                  xp.arange(out_W, dtype=numpy.float) + 0.5
              ) * x_scale - 0.5
              u = xp.maximum(u, 0)
          vw, v = xp.modf(v)
          uw, u = xp.modf(u)
      elif mode == "nearest":
          y_scale = H / out_H
          x_scale = W / out_W
          v = xp.minimum(
              xp.floor(xp.arange(out_H, dtype=numpy.float) * y_scale),
              H - 1,
          )
          u = xp.minimum(
              xp.floor(xp.arange(out_W, dtype=numpy.float) * x_scale),
              W - 1,
          )
          vw = xp.zeros_like(v)
          uw = xp.zeros_like(u)
      return v, u, vw, uw
  
imports: from __future__ import division
  import numpy
  from chainer import backend
  from chainer.backends import cuda
  from chainer import function_node
  from chainer.utils import type_check
label_desc: Use image node_id 6 for calling a global function with example usage: compute_indices_and_weights(out_size, in_size, mode, align_corners, xp) and returns: v,  u,  vw,  uw