parameters: (img, size, interpolation='bilinear')
docstring: Resizes the image to given size
  
      Args:
          input (PIL.Image): Image to be resized.
          size (int|list|tuple): Target size of input data, with (height, width) shape.
          interpolation (int|str, optional): Interpolation method. when use pil backend, 
              support method are as following: 
              - "nearest": Image.NEAREST, 
              - "bilinear": Image.BILINEAR, 
              - "bicubic": Image.BICUBIC, 
              - "box": Image.BOX, 
              - "lanczos": Image.LANCZOS, 
              - "hamming": Image.HAMMING
  
      Returns:
          PIL.Image: Resized image.
docstring_summary: Resizes the image to given size
docstring_tokens: Resizes the image to given size
function: def resize(img, size, interpolation='bilinear'):
      """
      Resizes the image to given size
  
      Args:
          input (PIL.Image): Image to be resized.
          size (int|list|tuple): Target size of input data, with (height, width) shape.
          interpolation (int|str, optional): Interpolation method. when use pil backend, 
              support method are as following: 
              - "nearest": Image.NEAREST, 
              - "bilinear": Image.BILINEAR, 
              - "bicubic": Image.BICUBIC, 
              - "box": Image.BOX, 
              - "lanczos": Image.LANCZOS, 
              - "hamming": Image.HAMMING
  
      Returns:
          PIL.Image: Resized image.
  
      """
  
      if not (isinstance(size, int) or
              (isinstance(size, Iterable) and len(size) == 2)):
          raise TypeError('Got inappropriate size arg: {}'.format(size))
  
      if isinstance(size, int):
          w, h = img.size
          if (w <= h and w == size) or (h <= w and h == size):
              return img
          if w < h:
              ow = size
              oh = int(size * h / w)
              return img.resize((ow, oh), _pil_interp_from_str[interpolation])
          else:
              oh = size
              ow = int(size * w / h)
              return img.resize((ow, oh), _pil_interp_from_str[interpolation])
      else:
          return img.resize(size[::-1], _pil_interp_from_str[interpolation])
function_tokens: def resize ( img , size , interpolation = 'bilinear' ) : if not ( isinstance ( size , int ) or ( isinstance ( size , Iterable ) and len ( size ) == 2 ) ) : raise TypeError ( 'Got inappropriate size arg: {}' . format ( size ) ) if isinstance ( size , int ) : w , h = img . size if ( w <= h and w == size ) or ( h <= w and h == size ) : return img if w < h : ow = size oh = int ( size * h / w ) return img . resize ( ( ow , oh ) , _pil_interp_from_str [ interpolation ] ) else : oh = size ow = int ( size * w / h ) return img . resize ( ( ow , oh ) , _pil_interp_from_str [ interpolation ] ) else : return img . resize ( size [ : : - 1 ] , _pil_interp_from_str [ interpolation ] )