class_docstr: Do a random resized crop and return both the resulting image and the location. See base class.
class_docstr_tok: ["Do","a","random","resized","crop","and","return","both","the","resulting","image","and","the","location",".","See","base","class","."]
docstr: Args:
      img (PIL Image or Tensor): Image to be cropped.
  Returns:
      PIL Image or Tensor: Randomly cropped image
      Location: Location object containing crop parameters
docstr_tok: ["Args",":","img","(","PIL","Image","or","Tensor",")",":","Image","to","be","cropped",".","Returns",":","PIL","Image","or","Tensor",":","Randomly","cropped","image","Location",":","Location","object","containing","crop","parameters"]
code: def forward(self, img: Image.Image) -> Tuple[Image.Image, Location]:
      """
      Args:
          img (PIL Image or Tensor): Image to be cropped.
      Returns:
          PIL Image or Tensor: Randomly cropped image
          Location: Location object containing crop parameters
  
      """
      top, left, height, width = self.get_params(
          img, self.scale, self.ratio
      )
      image_width, image_height = T.functional.get_image_size(img)
      location = Location(
          top=top,
          left=left,
          height=height,
          width=width,
          image_height=image_height,
          image_width=image_width,
      )
      img = T.functional.resized_crop(
          img, top, left, height, width, self.size, self.interpolation
      )
      return img, location
  
imports: from dataclasses import dataclass
  from typing import Tuple
  import torch
  import torchvision.transforms
  import torchvision.transforms.functional
  from PIL import Image
  from torch import nn
label_desc: Use image node_id 1 for calling the RandomResizedCropWithLocation obj's underlying member method code with example usage: obj.forward(img) and returns: img,  location