code: def _resize_cv2(img, size, interpolation):
      img = img.transpose((1, 2, 0))
      if interpolation == PIL.Image.NEAREST:
          cv_interpolation = cv2.INTER_NEAREST
      elif interpolation == PIL.Image.BILINEAR:
          cv_interpolation = cv2.INTER_LINEAR
      elif interpolation == PIL.Image.BICUBIC:
          cv_interpolation = cv2.INTER_CUBIC
      elif interpolation == PIL.Image.LANCZOS:
          cv_interpolation = cv2.INTER_LANCZOS4
      H, W = size
      img = cv2.resize(
          img, dsize=(W, H), interpolation=cv_interpolation
      )
  
      # If input is a grayscale image, cv2 returns a two-dimentional array.
      if len(img.shape) == 2:
          img = img[:, :, np.newaxis]
      return img.transpose((2, 0, 1))
  
imports: import chainer
  import numpy
  import PIL
label_desc: Use image node_id 1 for calling a global function with example usage: _resize_cv2(img, size, interpolation) and returns: img