docstr: Resize image by cv2 module.
  Args:
      img (numpy.ndarray): Image array to save.
          Image shape is considered as (height, width, channel) for RGB or (height, width) for gray-scale by default.
      size (tupple of int): (width, height).
      channel_first: bool
          This argument specifies the shape of img is whether (height, width, channel) or (channel, height, width).
          Default value is False, which means the img shape is (height, width, channel)
      interpolate (str):
          must be one of ["nearest", "bilinear", "bicubic", "lanczos"]
  Returns:
      numpy.ndarray whose shape is (size[1], size[0], channel) or (size[1], size[0])
docstr_tok: ["Resize","image","by","cv2","module",".","Args",":","img","(","numpy.ndarray",")",":","Image","array","to","save",".","Image","shape","is","considered","as","(","height",",","width",",","channel",")","for","RGB","or","(","height",",","width",")","for","gray-scale","by","default",".","size","(","tupple","of","int",")",":","(","width",",","height",")",".","channel_first",":","bool","This","argument","specifies","the","shape","of","img","is","whether","(","height",",","width",",","channel",")","or","(","channel",",","height",",","width",")",".","Default","value","is","False",",","which","means","the","img","shape","is","(","height",",","width",",","channel",")","interpolate","(","str",")",":","must","be","one","of","[","``","nearest","''",",","``","bilinear","''",",","``","bicubic","''",",","``","lanczos","''","]","Returns",":","numpy.ndarray","whose","shape","is","(","size","[","1","]",",","size","[","0","]",",","channel",")","or","(","size","[","1","]",",","size","[","0","]",")"]
code: def imresize(
      self, img, size, interpolate="bilinear", channel_first=False
  ):
      """
      Resize image by cv2 module.
      Args:
          img (numpy.ndarray): Image array to save.
              Image shape is considered as (height, width, channel) for RGB or (height, width) for gray-scale by default.
          size (tupple of int): (width, height).
          channel_first: bool
              This argument specifies the shape of img is whether (height, width, channel) or (channel, height, width).
              Default value is False, which means the img shape is (height, width, channel)
          interpolate (str):
              must be one of ["nearest", "bilinear", "bicubic", "lanczos"]
      Returns:
          numpy.ndarray whose shape is (size[1], size[0], channel) or (size[1], size[0])
      """
  
      img = _imresize_before(
          img,
          size,
          channel_first,
          interpolate,
          list(self._interpolations_map.keys()),
      )
  
      dtype = img.dtype
  
      expand_flag = len(img.shape) == 3 and img.shape[-1] == 1
      # if img shape is (h, w, 1),
      # cv2.reshape automatically shrink the last channel and the shape of returned img is (h, w)
  
      resized = cv2.resize(
          img, size, interpolation=self._interpolations_map[interpolate]
      )
  
      if expand_flag:
          resized = np.expand_dims(resized, axis=-1)
  
      return _imresize_after(resized, channel_first).astype(dtype)
  
file_path: nnabla/python/src/nnabla/utils/image_utils/backend_events/cv2_backend.py
imports: from __future__ import absolute_import, division
  import cv2
  import numpy
  from nnabla.logger import logger
  from .common import upscale_pixel_intensity, check_type_and_cast_if_necessary, _imread_before, _imread_after, _imsave_before, _imresize_before, _imresize_after
  from .image_utils_backend import ImageUtilsBackend
label_desc: Use image node_id 10 for calling the Cv2Backend obj's underlying member method code with example usage: obj.imresize(img, size, interpolate, channel_first) and returns: _imresize_after