code: def random_crop(images, size, boxes=None):
      """
      Perform random spatial crop on the given images and corresponding boxes.
      Args:
          images (tensor): images to perform random crop. The dimension is
              `num frames` x `channel` x `height` x `width`.
          size (int): the size of height and width to crop on the image.
          boxes (ndarray or None): optional. Corresponding boxes to images.
              Dimension is `num boxes` x 4.
      Returns:
          cropped (tensor): cropped images with dimension of
              `num frames` x `channel` x `size` x `size`.
          cropped_boxes (ndarray or None): the cropped boxes with dimension of
              `num boxes` x 4.
      """
      if images.shape[2] == size and images.shape[3] == size:
          return images, boxes
      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)
          if boxes is not None
          else None
      )
  
      return cropped, cropped_boxes
  
imports: import logging
  import math
  import numpy
  import random
  import torch
  import torchvision
  import torchvision.transforms.functional
  from PIL import Image, ImageFilter
  from scipy.ndimage import gaussian_filter
  from torchvision import transforms
  from .rand_augment import rand_augment_transform
  from .random_erasing import RandomErasing
label_desc: Use image node_id 4 for calling a global function with example usage: random_crop(images, size, boxes) and returns: cropped,  cropped_boxes, images,  boxes