class_docstr: Crop and/or pad image with random placement within the crop or pad margin.
      
class_docstr_tok: ["Crop","and\/or","pad","image","with","random","placement","within","the","crop","or","pad","margin","."]
docstr: Args:
      img (PIL Image or Tensor): Image to be cropped.
  
  Returns:
      PIL Image or Tensor: Cropped image.
docstr_tok: ["Args",":","img","(","PIL","Image","or","Tensor",")",":","Image","to","be","cropped",".","Returns",":","PIL","Image","or","Tensor",":","Cropped","image","."]
code: def forward(self, img):
      """
      Args:
          img (PIL Image or Tensor): Image to be cropped.
  
      Returns:
          PIL Image or Tensor: Cropped image.
      """
      top, left = self.get_params(img, self.size)
      return crop_or_pad(
          img,
          top=top,
          left=left,
          height=self.size[0],
          width=self.size[1],
          fill=self.fill,
          padding_mode=self.padding_mode,
      )
  
imports: import math
  import numbers
  import random
  import warnings
  from typing import List, Sequence, Tuple, Union
  import torch
  import torchvision.transforms.functional
  from PIL import Image
  import numpy
label_desc: Use image node_id 3 for calling the RandomCropOrPad obj's underlying member method code with example usage: obj.forward(img) and returns: crop_or_pad