code: def random_crop_with_boxes(
      images: torch.Tensor, size: int, boxes: torch.Tensor
  ) -> Tuple[torch.Tensor, torch.Tensor]:
      """
      Perform random spatial crop on the given images and corresponding boxes.
      Args:
          images (tensor): images to perform random crop. The dimension is
              `channel` x `num frames` x `height` x `width`.
          size (int): the size of height and width to crop on the image.
          boxes (tensor): Corresponding boxes to images.
              Dimension is `num boxes` x 4.
      Returns:
          cropped (tensor): cropped images with dimension of
              `channel` x `num frames` x `height` x `width`.
          cropped_boxes (tensor): the cropped boxes with dimension of
              `num boxes` x 4.
      """
      if images.shape[2] == size and images.shape[3] == size:
          return images
      height = images.shape[2]
      width = images.shape[3]
      y_offset = 0
      if height > size:
          y_offset = int(np.random.randint(0, height - size))
      x_offset = 0
      if width > size:
          x_offset = int(np.random.randint(0, width - size))
      cropped = images[
          :, :, y_offset : y_offset + size, x_offset : x_offset + size
      ]
  
      cropped_boxes = crop_boxes(boxes, x_offset, y_offset)
      return cropped, clip_boxes_to_image(
          cropped_boxes, cropped.shape[-2], cropped.shape[-1]
      )
  
imports: import copy
  import math
  from typing import Tuple
  import numpy
  import torch
label_desc: Use image node_id 8 for calling a global function with example usage: random_crop_with_boxes(images, size, boxes) and returns: cropped,  clip_boxes_to_image, images