class_docstr: Get parameters for ``perspective`` for a random perspective transform.
  
  Args:
      distortion_scale: the degree of distortion, ranged from 0 to 1.
      sampling_method: ``'basic'`` | ``'area_preserving'``. Default: ``'basic'``
          If ``'basic'``, samples by translating the image corners randomly inwards.
          If ``'area_preserving'``, samples by randomly translating the image corners in any direction.
          Preserves area on average. See https://arxiv.org/abs/2104.03308 for further details.
  
  Returns:
      A dict of parameters to be passed for transformation.
          - start_points (Tensor): element-wise perspective source areas with a shape of (B, 4, 2).
          - end_points (Tensor): element-wise perspective target areas with a shape of (B, 4, 2).
  
  Note:
      The generated random numbers are not reproducible across different devices and dtypes. By default,
      the parameters will be generated on CPU in float32. This can be changed by calling
      ``self.set_rng_device_and_dtype(device="cuda", dtype=torch.float64)``.
class_docstr_tok: ["Get","parameters","for","``","perspective","``","for","a","random","perspective","transform",".","Args",":","distortion_scale",":","the","degree","of","distortion",",","ranged","from","0","to","1.","sampling_method",":","``","'basic","'","``","|","``","'area_preserving","'","``",".","Default",":","``","'basic","'","``","If","``","'basic","'","``",",","samples","by","translating","the","image","corners","randomly","inwards",".","If","``","'area_preserving","'","``",",","samples","by","randomly","translating","the","image","corners","in","any","direction",".","Preserves","area","on","average",".","See","https",":","\/\/arxiv.org\/abs\/2104.03308","for","further","details",".","Returns",":","A","dict","of","parameters","to","be","passed","for","transformation",".","-","start_points","(","Tensor",")",":","element-wise","perspective","source","areas","with","a","shape","of","(","B",",","4",",","2",")",".","-","end_points","(","Tensor",")",":","element-wise","perspective","target","areas","with","a","shape","of","(","B",",","4",",","2",")",".","Note",":","The","generated","random","numbers","are","not","reproducible","across","different","devices","and","dtypes",".","By","default",",","the","parameters","will","be","generated","on","CPU","in","float32",".","This","can","be","changed","by","calling","``","self.set_rng_device_and_dtype","(","device=","''","cuda","''",",","dtype=torch.float64",")","``","."]
code: def __init__(
      self,
      distortion_scale: Union[Tensor, float] = 0.5,
      sampling_method: str = "basic",
  ) -> None:
      super().__init__()
      if sampling_method not in ("basic", "area_preserving"):
          raise NotImplementedError(
              f"Sampling method {sampling_method} not yet implemented."
          )
      self.distortion_scale = distortion_scale
      self.sampling_method = sampling_method
  
file_path: kornia/kornia/augmentation/random_generator/_2d/perspective.py
imports: from typing import Dict, 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
  from kornia.core import Tensor, tensor
  from kornia.utils.helpers import _extract_device_dtype
label_desc: Use image node_id 1 to create a new PerspectiveGenerator object from inherited base classes: RandomGeneratorBase with example: obj = PerspectiveGenerator(distortion_scale, sampling_method)