code: def _imresize_before(
      img, size, channel_first, interpolate, interpolations_map
  ):
      if not isinstance(img, np.ndarray):
          raise ValueError(
              "the input img for imresize must be numpy.ndarray."
          )
  
      if not isinstance(size, (list, tuple)):
          raise ValueError("size must be list or tuple")
  
      if len(img.shape) not in [2, 3]:
          raise ValueError(
              "Invalid dimension size of input image. (dims: {})".format(
                  len(img.shape)
              )
          )
  
      if interpolate not in interpolations_map:
          raise ValueError(
              "unknown interpolation type."
              " In this backend, you can use only one of [{}]".format(
                  ", ".join(interpolations_map)
              )
          )
  
      if img.dtype not in [np.uint8, np.uint16]:
          img = np.asarray(img, np.float32)
  
      if channel_first and len(img.shape) == 3:
          img = img.transpose((1, 2, 0))
  
      if len(img.shape) == 3 and np.prod(img.shape[:-1]) == 1:
          cur_dtype = img.dtype
          img = (img * np.ones((2, 2, 1))).astype(cur_dtype)
  
      return img
  
file_path: nnabla/python/src/nnabla/utils/image_utils/backend_events/common.py
imports: from __future__ import division, absolute_import
  import numpy
  from nnabla.logger import logger
label_desc: Use image node_id 10 for calling a global function with example usage: _imresize_before(img, size, channel_first, interpolate, interpolations_map) and returns: img