class_docstr: Apply multiple elementary affine transforms simultaneously.
  
  Args:
      angle: Angle in degrees for counter-clockwise rotation around the center. The tensor
          must have a shape of (B), where B is the batch size.
      translation: Amount of pixels for translation in x- and y-direction. The tensor must
          have a shape of (B, 2), where B is the batch size and the last dimension contains dx and dy.
      scale_factor: Factor for scaling. The tensor must have a shape of (B), where B is the
          batch size.
      shear: Angles in degrees for shearing in x- and y-direction around the center. The
          tensor must have a shape of (B, 2), where B is the batch size and the last dimension contains sx and sy.
      center: Transformation center in pixels. The tensor must have a shape of (B, 2), where
          B is the batch size and the last dimension contains cx and cy. Defaults to the center of image to be
          transformed.
      mode: interpolation mode to calculate output values
        ``'bilinear'`` | ``'nearest'``.
      padding_mode: padding mode for outside grid values
        ``'zeros'`` | ``'border'`` | ``'reflection'``.
      align_corners: interpolation flag.
  
  Raises:
      RuntimeError: If not one of ``angle``, ``translation``, ``scale_factor``, or ``shear`` is set.
  
  Returns:
      The transformed tensor with same shape as input.
  
  Example:
      >>> img = torch.rand(1, 2, 3, 5)
      >>> angle = 90. * torch.rand(1)
      >>> out = Affine(angle)(img)
      >>> print(out.shape)
      torch.Size([1, 2, 3, 5])
class_docstr_tok: ["Apply","multiple","elementary","affine","transforms","simultaneously",".","Args",":","angle",":","Angle","in","degrees","for","counter-clockwise","rotation","around","the","center",".","The","tensor","must","have","a","shape","of","(","B",")",",","where","B","is","the","batch","size",".","translation",":","Amount","of","pixels","for","translation","in","x-","and","y-direction",".","The","tensor","must","have","a","shape","of","(","B",",","2",")",",","where","B","is","the","batch","size","and","the","last","dimension","contains","dx","and","dy",".","scale_factor",":","Factor","for","scaling",".","The","tensor","must","have","a","shape","of","(","B",")",",","where","B","is","the","batch","size",".","shear",":","Angles","in","degrees","for","shearing","in","x-","and","y-direction","around","the","center",".","The","tensor","must","have","a","shape","of","(","B",",","2",")",",","where","B","is","the","batch","size","and","the","last","dimension","contains","sx","and","sy",".","center",":","Transformation","center","in","pixels",".","The","tensor","must","have","a","shape","of","(","B",",","2",")",",","where","B","is","the","batch","size","and","the","last","dimension","contains","cx","and","cy",".","Defaults","to","the","center","of","image","to","be","transformed",".","mode",":","interpolation","mode","to","calculate","output","values","``","'bilinear","'","``","|","``","'nearest","'","``",".","padding_mode",":","padding","mode","for","outside","grid","values","``","'zeros","'","``","|","``","'border","'","``","|","``","'reflection","'","``",".","align_corners",":","interpolation","flag",".","Raises",":","RuntimeError",":","If","not","one","of","``","angle","``",",","``","translation","``",",","``","scale_factor","``",",","or","``","shear","``","is","set",".","Returns",":","The","transformed","tensor","with","same","shape","as","input",".","Example",":",">",">",">","img","=","torch.rand","(","1",",","2",",","3",",","5",")",">",">",">","angle","=","90",".","*","torch.rand","(","1",")",">",">",">","out","=","Affine","(","angle",")","(","img",")",">",">",">","print","(","out.shape",")","torch.Size","(","[","1",",","2",",","3",",","5","]",")"]
code: def forward(self, input: torch.Tensor) -> torch.Tensor:
      if self.shear is None:
          sx = sy = None
      else:
          sx, sy = self.shear[..., 0], self.shear[..., 1]
  
      if self.center is None:
          center = _compute_tensor_center(input).expand(
              input.size()[0], -1
          )
      else:
          center = self.center
  
      matrix = get_affine_matrix2d(
          self.translation,
          center,
          self.scale_factor,
          -self.angle,
          sx=sx,
          sy=sy,
      )
      return affine(
          input,
          matrix[..., :2, :3],
          self.mode,
          self.padding_mode,
          self.align_corners,
      )
  
imports: from typing import Optional, Tuple, Union
  import torch
  from torch import nn
  from kornia.core import ones, ones_like, zeros
  from kornia.filters import gaussian_blur2d
  from kornia.utils import _extract_device_dtype
  from kornia.utils.image import perform_keep_shape_image
  from kornia.utils.misc import eye_like
  from .imgwarp import get_affine_matrix2d, get_projective_transform, get_rotation_matrix2d, warp_affine, warp_affine3d
label_desc: Use image node_id 2 for calling the Affine obj's underlying member method code with example usage: obj.forward(input) and returns: affine