code: def interpolate(
      x: Union[tf.Tensor, tf.Variable],
      size: Union[Sequence[int], int],
      /,
      *,
      mode: Literal[
          "linear",
          "bilinear",
          "trilinear",
          "nd",
          "nearest",
          "area",
          "nearest_exact",
          "tf_area",
          "tf_bicubic",
          "bicubic",
          "mitchellcubic",
          "lanczos3",
          "lanczos5",
          "gaussian",
      ] = "linear",
      scale_factor: Optional[Union[Sequence[int], int]] = None,
      recompute_scale_factor: Optional[bool] = None,
      align_corners: bool = False,
      antialias: bool = False,
      out: Optional[Union[tf.Tensor, tf.Variable]] = None,
  ):
      input_size = ivy.shape(x)[2:]
      dims = len(input_size)
      size, _ = _get_size(scale_factor, size, dims, input_size)
      if all(a == b for a, b in zip(size, input_size)):
          ret = x
      else:
          remove_dim = False
          if mode in [
              "linear",
              "tf_area",
              "lanczos3",
              "lanczos5",
              "nearest-exact",
          ]:
              if dims == 1:
                  size = (1,) + tuple(size)
                  x = tf.expand_dims(x, axis=-2)
                  dims = 2
                  remove_dim = True
              mode = (
                  "bilinear"
                  if mode == "linear"
                  else (
                      "area"
                      if mode == "tf_area"
                      else "nearest"
                      if mode == "nearest-exact"
                      else mode
                  )
              )
          if mode == "tf_bicubic":
              mode = "bicubic"
          x = tf.transpose(x, (0, *range(2, dims + 2), 1))
          ret = tf.transpose(
              tf.cast(
                  tf.image.resize(
                      x, size=size, method=mode, antialias=antialias
                  ),
                  x.dtype,
              ),
              (0, dims + 1, *range(1, dims + 1)),
          )
          if remove_dim:
              ret = tf.squeeze(ret, axis=-2)
      if ivy.exists(out):
          return ivy.inplace_update(out, ret)
      return ret
  
imports: import math
  from typing import Union, Optional, Tuple, List, Literal, Sequence, Callable
  import tensorflow
  from ivy.func_wrapper import inputs_to_ivy_arrays, output_to_native_arrays, with_unsupported_dtypes, with_supported_dtypes, with_supported_device_and_dtypes
  from ..None import backend_version
  import ivy
  from ivy.functional.ivy.layers import _handle_padding, _get_num_padded_values, _validate_max_pool_params, _depth_max_pooling_helper
  from ivy.functional.ivy.experimental.layers import _padding_ceil_mode, _get_size
label_desc: Use image node_id 21 for calling a global function with example usage: interpolate() and returns: ret, ivy