docstr: Resize image by pil 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 isyou can get the array whose shape is False, which means the img shape is (height, width, channels)
      interpolate (str):
          must be one of ["nearest", "box", "bilinear", "hamming", "bicubic", "lanczos"]
  Returns:
      numpy.ndarray whose shape is ('size'[1], 'size'[0], channel) or (size[1], size[0])
docstr_tok: ["Resize","image","by","pil","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","isyou","can","get","the","array","whose","shape","is","False",",","which","means","the","img","shape","is","(","height",",","width",",","channels",")","interpolate","(","str",")",":","must","be","one","of","[","``","nearest","''",",","``","box","''",",","``","bilinear","''",",","``","hamming","''",",","``","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 pil 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 isyou can get the array whose shape is False, which means the img shape is (height, width, channels)
          interpolate (str):
              must be one of ["nearest", "box", "bilinear", "hamming", "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()),
      )
  
      expand_flag = False
      if len(img.shape) == 3 and img.shape[-1] == 1:
          # (h, w, 1) can not be handled by pil.Image, temporally reshape to (h, w)
          img = img.reshape(img.shape[0], img.shape[1])
          expand_flag = True
  
      resample = self._interpolations_map[interpolate]
  
      if img.dtype == np.uint8:
          resized = self.pil_resize_from_ndarray(img, size, resample)
      else:
          dtype = img.dtype
          img_float32 = np.asarray(img, np.float32)
          if len(img.shape) == 3:
              resized = np.stack(
                  [
                      self.pil_resize_from_ndarray(
                          img_float32[..., i], size, resample
                      )
                      for i in range(img.shape[-1])
                  ],
                  axis=2,
              )
          else:
              resized = self.pil_resize_from_ndarray(
                  img_float32, size, resample
              )
  
          resized = np.asarray(resized, dtype)
  
      if expand_flag:
          resized = resized[..., np.newaxis]
  
      return _imresize_after(resized, channel_first)
  
file_path: nnabla/python/src/nnabla/utils/image_utils/backend_events/pil_backend.py
imports: from __future__ import absolute_import, division
  import numpy
  from PIL import Image
  from nnabla.logger import logger
  from .common import _imread_before, _imread_after, _imsave_before, _imresize_before, _imresize_after
  from .image_utils_backend import ImageUtilsBackend
label_desc: Use image node_id 8 for calling the PilBackend obj's underlying member method code with example usage: obj.imresize(img, size, interpolate, channel_first) and returns: _imresize_after