code: def short_side_scale(
      x: torch.Tensor,
      size: int,
      interpolation: str = "bilinear",
      backend: str = "pytorch",
  ) -> torch.Tensor:
      """
      Determines the shorter spatial dim of the video (i.e. width or height) and scales
      it to the given size. To maintain aspect ratio, the longer side is then scaled
      accordingly.
      Args:
          x (torch.Tensor): A video tensor of shape (C, T, H, W) and type torch.float32.
          size (int): The size the shorter side is scaled to.
          interpolation (str): Algorithm used for upsampling,
              options: nearest' | 'linear' | 'bilinear' | 'bicubic' | 'trilinear' | 'area'
          backend (str): backend used to perform interpolation. Options includes
              `pytorch` as default, and `opencv`. Note that opencv and pytorch behave
              differently on linear interpolation on some versions.
              https://discuss.pytorch.org/t/pytorch-linear-interpolation-is-different-from-pil-opencv/71181
      Returns:
          An x-like Tensor with scaled spatial dims.
      """  # noqa
      assert len(x.shape) == 4
      assert x.dtype == torch.float32
      assert backend in ("pytorch", "opencv")
      c, t, h, w = x.shape
      if w < h:
          new_h = int(math.floor((float(h) / w) * size))
          new_w = size
      else:
          new_h = size
          new_w = int(math.floor((float(w) / h) * size))
      if backend == "pytorch":
          return torch.nn.functional.interpolate(
              x,
              size=(new_h, new_w),
              mode=interpolation,
              align_corners=False,
          )
      elif backend == "opencv":
          return _interpolate_opencv(
              x, size=(new_h, new_w), interpolation=interpolation
          )
      else:
          raise NotImplementedError(f"{backend} backend not supported.")
  
imports: import copy
  import math
  from typing import Tuple
  import numpy
  import torch
label_desc: Use image node_id 3 for calling a global function with example usage: short_side_scale(x, size, interpolation, backend) and returns: torch, _interpolate_opencv