class_docstr: Crop the given PIL Image to random size and aspect ratio with random interpolation.
  
  A crop of random size (default: of 0.08 to 1.0) of the original size and a random
  aspect ratio (default: of 3/4 to 4/3) of the original aspect ratio is made. This crop
  is finally resized to given size.
  This is popularly used to train the Inception networks.
  
  Args:
      size: expected output size of each edge
      scale: range of size of the origin size cropped
      ratio: range of aspect ratio of the origin aspect ratio cropped
      interpolation: Default: PIL.Image.BILINEAR
class_docstr_tok: ["Crop","the","given","PIL","Image","to","random","size","and","aspect","ratio","with","random","interpolation",".","A","crop","of","random","size","(","default",":","of","0.08","to","1.0",")","of","the","original","size","and","a","random","aspect","ratio","(","default",":","of","3\/4","to","4\/3",")","of","the","original","aspect","ratio","is","made",".","This","crop","is","finally","resized","to","given","size",".","This","is","popularly","used","to","train","the","Inception","networks",".","Args",":","size",":","expected","output","size","of","each","edge","scale",":","range","of","size","of","the","origin","size","cropped","ratio",":","range","of","aspect","ratio","of","the","origin","aspect","ratio","cropped","interpolation",":","Default",":","PIL.Image.BILINEAR"]
docstr: Get parameters for ``crop`` for a random sized crop.
  
  Args:
      img (PIL Image): Image to be cropped.
      scale (tuple): range of size of the origin size cropped
      ratio (tuple): range of aspect ratio of the origin aspect ratio cropped
  
  Returns:
      tuple: params (i, j, h, w) to be passed to ``crop`` for a random
          sized crop.
docstr_tok: ["Get","parameters","for","``","crop","``","for","a","random","sized","crop",".","Args",":","img","(","PIL","Image",")",":","Image","to","be","cropped",".","scale","(","tuple",")",":","range","of","size","of","the","origin","size","cropped","ratio","(","tuple",")",":","range","of","aspect","ratio","of","the","origin","aspect","ratio","cropped","Returns",":","tuple",":","params","(","i",",","j",",","h",",","w",")","to","be","passed","to","``","crop","``","for","a","random","sized","crop","."]
code: def get_params(img, scale, ratio):
      """Get parameters for ``crop`` for a random sized crop.
  
      Args:
          img (PIL Image): Image to be cropped.
          scale (tuple): range of size of the origin size cropped
          ratio (tuple): range of aspect ratio of the origin aspect ratio cropped
  
      Returns:
          tuple: params (i, j, h, w) to be passed to ``crop`` for a random
              sized crop.
      """
      img_w, img_h = F.get_image_size(img)
      area = img_w * img_h
  
      for attempt in range(10):
          target_area = random.uniform(*scale) * area
          log_ratio = (math.log(ratio[0]), math.log(ratio[1]))
          aspect_ratio = math.exp(random.uniform(*log_ratio))
  
          target_w = int(round(math.sqrt(target_area * aspect_ratio)))
          target_h = int(round(math.sqrt(target_area / aspect_ratio)))
          if target_w <= img_w and target_h <= img_h:
              i = random.randint(0, img_h - target_h)
              j = random.randint(0, img_w - target_w)
              return i, j, target_h, target_w
  
      # Fallback to central crop
      in_ratio = img_w / img_h
      if in_ratio < min(ratio):
          target_w = img_w
          target_h = int(round(target_w / min(ratio)))
      elif in_ratio > max(ratio):
          target_h = img_h
          target_w = int(round(target_h * max(ratio)))
      else:  # whole image
          target_w = img_w
          target_h = img_h
      i = (img_h - target_h) // 2
      j = (img_w - target_w) // 2
      return i, j, target_h, target_w
  
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 2 for calling the RandomResizedCropAndInterpolation obj's underlying member method code with example usage: obj.get_params(img, scale, ratio) and returns: i,  j,  target_h,  target_w, i,  j,  target_h,  target_w