class_docstr: Get cropping heights and widths for ```crop``` transformation for resized crop transform.
  
  Args:
      output_size (Tuple[int, int]): expected output size of each edge.
      scale (Tensor): range of size of the origin size cropped with (2,) shape.
      ratio (Tensor): range of aspect ratio of the origin aspect ratio cropped with (2,) shape.
  
  Returns:
      params Dict[str, Tensor]: parameters to be passed for transformation.
          - size (Tensor): element-wise cropping sizes with a shape of (B, 2).
  
  Note:
      The generated random numbers are not reproducible across different devices and dtypes.
  
  Examples:
      >>> _ = torch.manual_seed(42)
      >>> rcg = ResizedCropGenerator((30, 30), scale=torch.tensor([.7, 1.3]), ratio=torch.tensor([.9, 1.]))
      >>> out = rcg(torch.Size([1, 3, 3]))
      >>> out["src"]
      tensor([[[0., 0.],
               [2., 0.],
               [2., 2.],
               [0., 2.]]])
      >>> out["dst"]
      tensor([[[ 0.,  0.],
               [29.,  0.],
               [29., 29.],
               [ 0., 29.]]])
      >>> out["input_size"]
      tensor([[3, 3]])
      >>> out["output_size"]
      tensor([[30, 30]])
class_docstr_tok: ["Get","cropping","heights","and","widths","for","``","`","crop","``","`","transformation","for","resized","crop","transform",".","Args",":","output_size","(","Tuple","[","int",",","int","]",")",":","expected","output","size","of","each","edge",".","scale","(","Tensor",")",":","range","of","size","of","the","origin","size","cropped","with","(","2",",",")","shape",".","ratio","(","Tensor",")",":","range","of","aspect","ratio","of","the","origin","aspect","ratio","cropped","with","(","2",",",")","shape",".","Returns",":","params","Dict","[","str",",","Tensor","]",":","parameters","to","be","passed","for","transformation",".","-","size","(","Tensor",")",":","element-wise","cropping","sizes","with","a","shape","of","(","B",",","2",")",".","Note",":","The","generated","random","numbers","are","not","reproducible","across","different","devices","and","dtypes",".","Examples",":",">",">",">","_","=","torch.manual_seed","(","42",")",">",">",">","rcg","=","ResizedCropGenerator","(","(","30",",","30",")",",","scale=torch.tensor","(","[",".7",",","1.3","]",")",",","ratio=torch.tensor","(","[",".9",",","1",".","]",")",")",">",">",">","out","=","rcg","(","torch.Size","(","[","1",",","3",",","3","]",")",")",">",">",">","out","[","``","src","''","]","tensor","(","[","[","[","0.",",","0",".","]",",","[","2.",",","0",".","]",",","[","2.",",","2",".","]",",","[","0.",",","2",".","]","]","]",")",">",">",">","out","[","``","dst","''","]","tensor","(","[","[","[","0.",",","0",".","]",",","[","29.",",","0",".","]",",","[","29.",",","29",".","]",",","[","0.",",","29",".","]","]","]",")",">",">",">","out","[","``","input_size","''","]","tensor","(","[","[","3",",","3","]","]",")",">",">",">","out","[","``","output_size","''","]","tensor","(","[","[","30",",","30","]","]",")"]
code: def forward(
      self, batch_shape: Tuple[int, ...], same_on_batch: bool = False
  ) -> Dict[str, Tensor]:
      batch_size = batch_shape[0]
      size = (batch_shape[-2], batch_shape[-1])
      _device, _dtype = _extract_device_dtype([self.scale, self.ratio])
  
      if batch_size == 0:
          return {
              "src": zeros([0, 4, 2], device=_device, dtype=_dtype),
              "dst": zeros([0, 4, 2], device=_device, dtype=_dtype),
              "size": zeros([0, 2], device=_device, dtype=_dtype),
          }
  
      rand = _adapted_rsampling(
          (batch_size, 10), self.rand_sampler, same_on_batch
      ).to(device=_device, dtype=_dtype)
      area = (
          (rand * (self.scale[1] - self.scale[0]) + self.scale[0])
          * size[0]
          * size[1]
      )
      log_ratio = _adapted_rsampling(
          (batch_size, 10), self.log_ratio_sampler, same_on_batch
      ).to(device=_device, dtype=_dtype)
      aspect_ratio = torch.exp(log_ratio)
  
      w = torch.sqrt(area * aspect_ratio).round().floor()
      h = torch.sqrt(area / aspect_ratio).round().floor()
      # Element-wise w, h condition
      cond = ((0 < w) * (w < size[0]) * (0 < h) * (h < size[1])).int()
  
      # torch.argmax is not reproducible across devices: https://github.com/pytorch/pytorch/issues/17738
      # Here, we will select the first occurrence of the duplicated elements.
      cond_bool, argmax_dim1 = (
          (cond.cumsum(1) == 1) & cond.bool()
      ).max(1)
      h_out = w[
          torch.arange(0, batch_size, device=_device, dtype=torch.long),
          argmax_dim1,
      ]
      w_out = h[
          torch.arange(0, batch_size, device=_device, dtype=torch.long),
          argmax_dim1,
      ]
  
      if not cond_bool.all():
          # Fallback to center crop
          in_ratio = float(size[0]) / float(size[1])
          _min = (
              float(self.ratio.min())
              if isinstance(self.ratio, Tensor)
              else min(self.ratio)
          )
          if in_ratio < _min:
              h_ct = tensor(size[0], device=_device, dtype=_dtype)
              w_ct = torch.round(h_ct / _min)
          elif in_ratio > _min:
              w_ct = tensor(size[1], device=_device, dtype=_dtype)
              h_ct = torch.round(w_ct * _min)
          else:  # whole image
              h_ct = tensor(size[0], device=_device, dtype=_dtype)
              w_ct = tensor(size[1], device=_device, dtype=_dtype)
          h_ct = h_ct.floor()
          w_ct = w_ct.floor()
  
          h_out = h_out.where(cond_bool, h_ct)
          w_out = w_out.where(cond_bool, w_ct)
  
      # Update the crop size.
      self.size = torch.stack([h_out, w_out], dim=1)
      return super().forward(batch_shape, same_on_batch)
  
imports: from typing import Dict, Optional, Tuple, Union
  import torch
  from torch.distributions import Uniform
  from kornia.augmentation.random_generator.base import RandomGeneratorBase
  from kornia.augmentation.utils import _adapted_rsampling, _common_param_check, _joint_range_check
  from kornia.core import Device, Tensor, tensor, where, zeros
  from kornia.geometry.bbox import bbox_generator
  from kornia.utils.helpers import _extract_device_dtype
label_desc: Use image node_id 4 for calling the ResizedCropGenerator obj's underlying member method code with example usage: obj.forward(batch_shape, same_on_batch) and returns: super, dict