code: def lighting_jitter(images, alphastd, eigval, eigvec):
      """
      Perform AlexNet-style PCA jitter on the given images.
      Args:
          images (tensor): images to perform lighting jitter. Dimension is
              `num frames` x `channel` x `height` x `width`.
          alphastd (float): jitter ratio for PCA jitter.
          eigval (list): eigenvalues for PCA jitter.
          eigvec (list[list]): eigenvectors for PCA jitter.
      Returns:
          out_images (tensor): the jittered images, the dimension is
              `num frames` x `channel` x `height` x `width`.
      """
      if alphastd == 0:
          return images
      # generate alpha1, alpha2, alpha3.
      alpha = np.random.normal(0, alphastd, size=(1, 3))
      eig_vec = np.array(eigvec)
      eig_val = np.reshape(eigval, (1, 3))
      rgb = np.sum(
          eig_vec
          * np.repeat(alpha, 3, axis=0)
          * np.repeat(eig_val, 3, axis=0),
          axis=1,
      )
      out_images = torch.zeros_like(images)
      if len(images.shape) == 3:
          # C H W
          channel_dim = 0
      elif len(images.shape) == 4:
          # T C H W
          channel_dim = 1
      else:
          raise NotImplementedError(
              f"Unsupported dimension {len(images.shape)}"
          )
  
      for idx in range(images.shape[channel_dim]):
          # C H W
          if len(images.shape) == 3:
              out_images[idx] = images[idx] + rgb[2 - idx]
          # T C H W
          elif len(images.shape) == 4:
              out_images[:, idx] = images[:, idx] + rgb[2 - idx]
          else:
              raise NotImplementedError(
                  f"Unsupported dimension {len(images.shape)}"
              )
  
      return out_images
  
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 14 for calling a global function with example usage: lighting_jitter(images, alphastd, eigval, eigvec) and returns: out_images, images