code: def resize(
      image,
      size,
      interpolation="bilinear",
      antialias=False,
      data_format="channels_last",
  ):
      try:
          import torchvision
          from torchvision.transforms import InterpolationMode as im
  
          RESIZE_INTERPOLATIONS.update(
              {
                  "bilinear": im.BILINEAR,
                  "nearest": im.NEAREST_EXACT,
                  "bicubic": im.BICUBIC,
              }
          )
      except:
          raise ImportError(
              "The torchvision package is necessary to use `resize` with the "
              "torch backend. Please install torchvision."
          )
      if interpolation in UNSUPPORTED_INTERPOLATIONS:
          raise ValueError(
              "Resizing with Lanczos interpolation is "
              "not supported by the PyTorch backend. "
              f"Received: interpolation={interpolation}."
          )
      if interpolation not in RESIZE_INTERPOLATIONS:
          raise ValueError(
              "Invalid value for argument `interpolation`. Expected of one "
              f"{RESIZE_INTERPOLATIONS}. Received: interpolation={interpolation}"
          )
      if not len(size) == 2:
          raise ValueError(
              "Argument `size` must be a tuple of two elements "
              f"(height, width). Received: size={size}"
          )
      size = tuple(size)
      image = convert_to_tensor(image)
      if data_format == "channels_last":
          if image.ndim == 4:
              image = image.permute((0, 3, 1, 2))
          elif image.ndim == 3:
              image = image.permute((2, 0, 1))
          else:
              raise ValueError(
                  "Invalid input rank: expected rank 3 (single image) "
                  "or rank 4 (batch of images). Received input with shape: "
                  f"image.shape={image.shape}"
              )
  
      resized = torchvision.transforms.functional.resize(
          img=image,
          size=size,
          interpolation=RESIZE_INTERPOLATIONS[interpolation],
          antialias=antialias,
      )
      if data_format == "channels_last":
          if len(image.shape) == 4:
              resized = resized.permute((0, 2, 3, 1))
          elif len(image.shape) == 3:
              resized = resized.permute((1, 2, 0))
      return resized
  
file_path: keras/keras/backend/torch/image.py
imports: import functools
  import itertools
  import operator
  import torch
  from keras.backend.torch.core import convert_to_tensor
label_desc: Use image node_id 1 for calling a global function with example usage: resize(image, size, interpolation, antialias, data_format) and returns: resized