code: def interpolate(
      x,
      scale=None,
      output_size=None,
      mode="linear",
      align_corners=False,
      half_pixel=False,
      half_pixel_for_nn=False,
      channel_last=False,
  ):
      """
      Resize an ND array with interpolation.
  
      Scaling factors for spatial dimensions are determined by either
      ``scale`` or ``output_size``.
  
      ``nd = len(scale)`` or ``nd = len(output_size)`` determines the number of
      spatial dimensions, and the last ``nd`` dimensions of the input ``x`` are
      considered as the spatial dimensions to be resized.
  
  
      If ``scale`` is given, the ``output_size`` is calculated by
  
      .. code-block:: python
  
        output_size[i] = floor(scale[i] * x.shape[i - len(scale)]).
  
      Calculation of the coordinate transformation are as follows.
  
      The input coordinate i_input is computed by the output coordinate i_output,
      the input size size_input, and the output size size_output as
  
      .. table::
          :align: center
          :widths: auto
  
          ================= ============== =================================================================
           align_corners     half_pixel                            i_input
          ================= ============== =================================================================
                True             True       Not supported.
          ----------------- -------------- -----------------------------------------------------------------
                True             False      i_output * (size_input - 1) / (size_output - 1)
          ----------------- -------------- -----------------------------------------------------------------
                False            True       (i_output + 0.5) * size_input / size_output - 0.5
          ----------------- -------------- -----------------------------------------------------------------
                False            False      i_output * size_input / size_output
          ================= ============== =================================================================
  
  
      In the case of the `nearest` mode and ``half_pixel_for_nn`` is ``True``,
      the input coordinate i_input is computed by the output coordinate i_output as
  
      .. code-block::
  
        i_input = (i_output + 0.5) * size_input / size_output.
  
  
      Example:
  
      .. code-block:: python
  
          import numpy as np
          import nnabla as nn
          import nnabla.functions as F
  
          x_data = np.random.rand(64, 3, 224, 224)
          x = nn.Variable.from_numpy_array(x_data)
  
          # Resize by scales
          y = F.interpolate(x, scale=(2, 2), mode='linear')
          print(y.shape)  # (64, 3, 448, 448)
          y.forward()
          print(y.d)  # Print output
  
          # Resize to a size
          y2 = F.interpolate(x, output_size=(320, 257), mode='linear')
          print(y2.shape)  # (64, 3, 320, 257)
          y2.forward()
          print(y2.d)  # Print output
  
      Args:
          x(~nnabla.Variable): N-D array with an arbitrary number of dimensions.
          scale(tuple of ints): Scale factors along axes. The default is
              ``None``, and if this is omitted, ``output_size`` must be specified.
          output_size(tuple of ints): The output sizes for axes. If this is
              given, the scale factors are determined by the output sizes and the
              input sizes. The default is ``None``, and if this is omitted,
              ``scale`` must be specified.
          mode(str): Interpolation mode chosen from ('linear'|'nearest').
              The default is 'linear'.
          align_corners(bool): If true, the corner pixels of input and output
              arrays are aligned, such that the output corner pixels have the
              same values with the input corner pixels. Default is ``False``.
          half_pixel:
              If true, in the coordinate transformation, 0.5 is added to the output coordinate
              and 0.5 is subtracted from the input coordinate after scaling. Default is ``False``.
          half_pixel_for_nn:
              This is a special argument to support the backward-compatibility of the nearest neighbor interpolation.
              Default is ``False``. When in ``True``, the implementation of nearest neighbor interpolation
              is the old one.
          channel_last: Last dimension is the channel (NHWC order) if True.
  
      Returns:
          ~nnabla.Variable: N-D array.
  
      .. warning::
          Up to the version 1.8.0, the default of `align_corners` was ``None``, and it becomes ``True``
          if `mode` is linear, otherwise ``False``.
  
      .. warning::
          Up to the version 1.8.0, the nearest `mode` interpolation corresponds to
          the nearest `mode` and `half_pixel_for_nn` = ``True`` after the version 1.8.0.
  
      """
      from .function_bases import interpolate as interpolate_base
      import math
  
      if scale is None and output_size is None:
          raise ValueError("Either scale or output_size must be given")
      elif output_size is None:
          input_size = (
              x.shape[-len(scale) - 1 : -1]
              if channel_last
              else x.shape[-len(scale) :]
          )
          output_size = [
              int(math.floor(s * d)) for d, s in zip(input_size, scale)
          ]
      return interpolate_base(
          x,
          output_size,
          mode,
          align_corners,
          half_pixel,
          half_pixel_for_nn,
          channel_last,
      )
  
imports: from __future__ import absolute_import
  from .function_bases import *
  from .None import dtypes
  import nnabla
  import numpy
  from .normalization_functions import *
  from .numpy_compat_functions import *
label_desc: Use image node_id 19 for calling a global function with example usage: interpolate(x, scale, output_size, mode, align_corners, half_pixel, half_pixel_for_nn, channel_last) and returns: interpolate_base