code: def random_resized_crop(
      frames: torch.Tensor,
      target_height: int,
      target_width: int,
      scale: Tuple[float, float],
      aspect_ratio: Tuple[float, float],
      shift: bool = False,
      log_uniform_ratio: bool = True,
      interpolation: str = "bilinear",
      num_tries: int = 10,
  ) -> torch.Tensor:
      """
      Crop the given images to random size and aspect ratio. A crop of random
      size relative to the original size and a random aspect ratio is made. This
      crop is finally resized to given size. This is popularly used to train the
      Inception networks.
  
      Args:
          frames (torch.Tensor): Video tensor to be resized with shape (C, T, H, W).
          target_height (int): Desired height after cropping.
          target_width (int): Desired width after cropping.
          scale (Tuple[float, float]): Scale range of Inception-style area based
              random resizing. Should be between 0.0 and 1.0.
          aspect_ratio (Tuple[float, float]): Aspect ratio range of Inception-style
              area based random resizing. Should be between 0.0 and +infinity.
          shift (bool): Bool that determines whether or not to sample two different
              boxes (for cropping) for the first and last frame. If True, it then
              linearly interpolates the two boxes for other frames. If False, the
              same box is cropped for every frame. Default is False.
          log_uniform_ratio (bool): Whether to use a log-uniform distribution to
              sample the aspect ratio. Default is True.
          interpolation (str): Algorithm used for upsampling. Currently supports
              'nearest', 'bilinear', 'bicubic', 'area'. Default is 'bilinear'.
          num_tries (int): The number of times to attempt a randomly resized crop.
              Falls back to a central crop after all attempts are exhausted.
              Default is 10.
  
      Returns:
          cropped (tensor): A cropped video tensor of shape (C, T, target_height, target_width).
      """
      assert (
          scale[0] > 0 and scale[1] > 0
      ), "min and max of scale range must be greater than 0"
      assert (
          aspect_ratio[0] > 0 and aspect_ratio[1] > 0
      ), "min and max of aspect_ratio range must be greater than 0"
  
      channels = frames.shape[0]
      t = frames.shape[1]
      height = frames.shape[2]
      width = frames.shape[3]
  
      i, j, h, w = _get_param_spatial_crop(
          scale,
          aspect_ratio,
          height,
          width,
          log_uniform_ratio,
          num_tries,
      )
  
      if not shift:
          cropped = frames[:, :, i : i + h, j : j + w]
          return torch.nn.functional.interpolate(
              cropped,
              size=(target_height, target_width),
              mode=interpolation,
          )
  
      i_, j_, h_, w_ = _get_param_spatial_crop(
          scale,
          aspect_ratio,
          height,
          width,
          log_uniform_ratio,
          num_tries,
      )
      i_s = [int(i) for i in torch.linspace(i, i_, steps=t).tolist()]
      j_s = [int(i) for i in torch.linspace(j, j_, steps=t).tolist()]
      h_s = [int(i) for i in torch.linspace(h, h_, steps=t).tolist()]
      w_s = [int(i) for i in torch.linspace(w, w_, steps=t).tolist()]
      cropped = torch.zeros((channels, t, target_height, target_width))
      for ind in range(t):
          cropped[
              :, ind : ind + 1, :, :
          ] = torch.nn.functional.interpolate(
              frames[
                  :,
                  ind : ind + 1,
                  i_s[ind] : i_s[ind] + h_s[ind],
                  j_s[ind] : j_s[ind] + w_s[ind],
              ],
              size=(target_height, target_width),
              mode=interpolation,
          )
      return cropped
  
imports: import copy
  import math
  from typing import Tuple
  import numpy
  import torch
label_desc: Use image node_id 16 for calling a global function with example usage: random_resized_crop(frames, target_height, target_width, scale, aspect_ratio, shift, log_uniform_ratio, interpolation, num_tries) and returns: cropped, torch