class_docstr: Randomly select a rectangle region in the input image or video and erase its pixels.
  
  This transform does not support PIL Image.
  'Random Erasing Data Augmentation' by Zhong et al. See https://arxiv.org/abs/1708.04896
  
  Args:
      p (float, optional): probability that the random erasing operation will be performed.
      scale (tuple of float, optional): range of proportion of erased area against input image.
      ratio (tuple of float, optional): range of aspect ratio of erased area.
      value (number or tuple of numbers): erasing value. Default is 0. If a single int, it is used to
          erase all pixels. If a tuple of length 3, it is used to erase
          R, G, B channels respectively.
          If a str of 'random', erasing each pixel with random values.
      inplace (bool, optional): boolean to make this transform inplace. Default set to False.
  
  Returns:
      Erased input.
  
  Example:
      >>> from torchvision.transforms import v2 as transforms
      >>>
      >>> transform = transforms.Compose([
      >>>   transforms.RandomHorizontalFlip(),
      >>>   transforms.PILToTensor(),
      >>>   transforms.ConvertImageDtype(torch.float),
      >>>   transforms.Normalize((0.485, 0.456, 0.406), (0.229, 0.224, 0.225)),
      >>>   transforms.RandomErasing(),
      >>> ])
class_docstr_tok: ["Randomly","select","a","rectangle","region","in","the","input","image","or","video","and","erase","its","pixels",".","This","transform","does","not","support","PIL","Image",".","'Random","Erasing","Data","Augmentation","'","by","Zhong","et","al",".","See","https",":","\/\/arxiv.org\/abs\/1708.04896","Args",":","p","(","float",",","optional",")",":","probability","that","the","random","erasing","operation","will","be","performed",".","scale","(","tuple","of","float",",","optional",")",":","range","of","proportion","of","erased","area","against","input","image",".","ratio","(","tuple","of","float",",","optional",")",":","range","of","aspect","ratio","of","erased","area",".","value","(","number","or","tuple","of","numbers",")",":","erasing","value",".","Default","is","0",".","If","a","single","int",",","it","is","used","to","erase","all","pixels",".","If","a","tuple","of","length","3",",","it","is","used","to","erase","R",",","G",",","B","channels","respectively",".","If","a","str","of","'random","'",",","erasing","each","pixel","with","random","values",".","inplace","(","bool",",","optional",")",":","boolean","to","make","this","transform","inplace",".","Default","set","to","False",".","Returns",":","Erased","input",".","Example",":",">",">",">","from","torchvision.transforms","import","v2","as","transforms",">",">",">",">",">",">","transform","=","transforms.Compose","(","[",">",">",">","transforms.RandomHorizontalFlip","(",")",",",">",">",">","transforms.PILToTensor","(",")",",",">",">",">","transforms.ConvertImageDtype","(","torch.float",")",",",">",">",">","transforms.Normalize","(","(","0.485",",","0.456",",","0.406",")",",","(","0.229",",","0.224",",","0.225",")",")",",",">",">",">","transforms.RandomErasing","(",")",",",">",">",">","]",")"]
code: def _get_params(self, flat_inputs: List[Any]) -> Dict[str, Any]:
      img_c, img_h, img_w = query_chw(flat_inputs)
  
      if self.value is not None and not (len(self.value) in (1, img_c)):
          raise ValueError(
              f"If value is a sequence, it should have either a single value or {img_c} (number of inpt channels)"
          )
  
      area = img_h * img_w
  
      log_ratio = self._log_ratio
      for _ in range(10):
          erase_area = (
              area
              * torch.empty(1)
              .uniform_(self.scale[0], self.scale[1])
              .item()
          )
          aspect_ratio = torch.exp(
              torch.empty(1).uniform_(
                  log_ratio[0],  # type: ignore[arg-type]
                  log_ratio[1],  # type: ignore[arg-type]
              )
          ).item()
  
          h = int(round(math.sqrt(erase_area * aspect_ratio)))
          w = int(round(math.sqrt(erase_area / aspect_ratio)))
          if not (h < img_h and w < img_w):
              continue
  
          if self.value is None:
              v = torch.empty(
                  [img_c, h, w], dtype=torch.float32
              ).normal_()
          else:
              v = torch.tensor(self.value)[:, None, None]
  
          i = torch.randint(0, img_h - h + 1, size=(1,)).item()
          j = torch.randint(0, img_w - w + 1, size=(1,)).item()
          break
      else:
          i, j, h, w, v = 0, 0, img_h, img_w, None
  
      return dict(i=i, j=j, h=h, w=w, v=v)
  
imports: import math
  import numbers
  import warnings
  from typing import Any, Callable, Dict, List, Tuple
  import PIL.Image
  import torch
  from torch.nn.functional import one_hot
  from torch.utils._pytree import tree_flatten, tree_unflatten
  from torchvision import transforms, tv_tensors
  from torchvision.transforms.v2 import functional
  from ._transform import _RandomApplyTransform, Transform
  from ._utils import _parse_labels_getter, has_any, is_pure_tensor, query_chw, query_size
label_desc: Use image node_id 4 for calling the RandomErasing obj's underlying member method code with example usage: obj._get_params(flat_inputs) and returns: dict