class_docstr: Get parameters for ``affine`` for a random affine transform.
  
  Args:
      degrees: Range of degrees to select from like (min, max).
      translate: tuple of maximum absolute fraction for horizontal
          and vertical translations. For example translate=(a, b), then horizontal shift
          is randomly sampled in the range -img_width * a < dx < img_width * a and vertical shift is
          randomly sampled in the range -img_height * b < dy < img_height * b. Will not translate by default.
      scale: scaling factor interval, e.g (a, b), then scale is
          randomly sampled from the range a <= scale <= b. Will keep original scale by default.
      shear: Range of degrees to select from.
          If float, a shear parallel to the x axis in the range (-shear, +shear) will be applied.
          If (a, b), a shear parallel to the x axis in the range (-shear, +shear) will be applied.
          If (a, b, c, d), then x-axis shear in (shear[0], shear[1]) and y-axis shear in (shear[2], shear[3])
          will be applied. Will not apply shear by default.
          If tensor, shear is a 2x2 tensor, a x-axis shear in (shear[0][0], shear[0][1]) and y-axis shear in
          (shear[1][0], shear[1][1]) will be applied. Will not apply shear by default.
  
  Returns:
      A dict of parameters to be passed for transformation.
          - translations (Tensor): element-wise translations with a shape of (B, 2).
          - center (Tensor): element-wise center with a shape of (B, 2).
          - scale (Tensor): element-wise scales with a shape of (B, 2).
          - angle (Tensor): element-wise rotation angles with a shape of (B,).
          - shear_x (Tensor): element-wise x-axis shears with a shape of (B,).
          - shear_y (Tensor): element-wise y-axis shears with a shape of (B,).
  
  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","``","affine","``","for","a","random","affine","transform",".","Args",":","degrees",":","Range","of","degrees","to","select","from","like","(","min",",","max",")",".","translate",":","tuple","of","maximum","absolute","fraction","for","horizontal","and","vertical","translations",".","For","example","translate=","(","a",",","b",")",",","then","horizontal","shift","is","randomly","sampled","in","the","range","-img_width","*","a","<","dx","<","img_width","*","a","and","vertical","shift","is","randomly","sampled","in","the","range","-img_height","*","b","<","dy","<","img_height","*","b",".","Will","not","translate","by","default",".","scale",":","scaling","factor","interval",",","e.g","(","a",",","b",")",",","then","scale","is","randomly","sampled","from","the","range","a","<","=","scale","<","=","b",".","Will","keep","original","scale","by","default",".","shear",":","Range","of","degrees","to","select","from",".","If","float",",","a","shear","parallel","to","the","x","axis","in","the","range","(","-shear",",","+shear",")","will","be","applied",".","If","(","a",",","b",")",",","a","shear","parallel","to","the","x","axis","in","the","range","(","-shear",",","+shear",")","will","be","applied",".","If","(","a",",","b",",","c",",","d",")",",","then","x-axis","shear","in","(","shear","[","0","]",",","shear","[","1","]",")","and","y-axis","shear","in","(","shear","[","2","]",",","shear","[","3","]",")","will","be","applied",".","Will","not","apply","shear","by","default",".","If","tensor",",","shear","is","a","2x2","tensor",",","a","x-axis","shear","in","(","shear","[","0","]","[","0","]",",","shear","[","0","]","[","1","]",")","and","y-axis","shear","in","(","shear","[","1","]","[","0","]",",","shear","[","1","]","[","1","]",")","will","be","applied",".","Will","not","apply","shear","by","default",".","Returns",":","A","dict","of","parameters","to","be","passed","for","transformation",".","-","translations","(","Tensor",")",":","element-wise","translations","with","a","shape","of","(","B",",","2",")",".","-","center","(","Tensor",")",":","element-wise","center","with","a","shape","of","(","B",",","2",")",".","-","scale","(","Tensor",")",":","element-wise","scales","with","a","shape","of","(","B",",","2",")",".","-","angle","(","Tensor",")",":","element-wise","rotation","angles","with","a","shape","of","(","B",",",")",".","-","shear_x","(","Tensor",")",":","element-wise","x-axis","shears","with","a","shape","of","(","B",",",")",".","-","shear_y","(","Tensor",")",":","element-wise","y-axis","shears","with","a","shape","of","(","B",",",")",".","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,
      degrees: Union[Tensor, float, Tuple[float, float]],
      translate: Optional[Union[Tensor, Tuple[float, float]]] = None,
      scale: Optional[
          Union[
              Tensor,
              Tuple[float, float],
              Tuple[float, float, float, float],
          ]
      ] = None,
      shear: Optional[Union[Tensor, float, Tuple[float, float]]] = None,
  ) -> None:
      super().__init__()
      self.degrees = degrees
      self.translate = translate
      self.scale = scale
      self.shear = shear
  
file_path: kornia/kornia/augmentation/random_generator/_2d/affine.py
imports: from typing import Dict, Optional, Tuple, Union
  import torch
  from kornia.augmentation.random_generator.base import RandomGeneratorBase, UniformDistribution
  from kornia.augmentation.utils import _adapted_rsampling, _common_param_check, _joint_range_check, _range_bound
  from kornia.core import Tensor, as_tensor, concatenate, stack, tensor, zeros
  from kornia.utils.helpers import _extract_device_dtype
label_desc: Use image node_id 1 to create a new AffineGenerator object from inherited base classes: RandomGeneratorBase with example: obj = AffineGenerator(degrees, translate, scale, shear)