class_docstr: Apply random rotations to 3D volumes (5D tensor).
  
  Input should be a tensor of shape (C, D, H, W) or a batch of tensors :math:`(B, C, D, H, W)`.
  If Input is a tuple it is assumed that the first element contains the aforementioned tensors and the second,
  the corresponding transformation matrix that has been applied to them. In this case the module
  will rotate the tensors and concatenate the corresponding transformation matrix to the
  previous one. This is especially useful when using this functionality as part of an ``nn.Sequential`` module.
  
  Args:
      degrees: Range of degrees to select from.
          If degrees is a number, then yaw, pitch, roll will be generated from the range of (-degrees, +degrees).
          If degrees is a tuple of (min, max), then yaw, pitch, roll will be generated from the range of (min, max).
          If degrees is a list of floats [a, b, c], then yaw, pitch, roll will be generated from (-a, a), (-b, b)
          and (-c, c).
          If degrees is a list of tuple ((a, b), (m, n), (x, y)), then yaw, pitch, roll will be generated from
          (a, b), (m, n) and (x, y).
          Set to 0 to deactivate rotations.
      resample: resample mode from "nearest" (0) or "bilinear" (1).
      same_on_batch: apply the same transformation across the batch.
      align_corners: interpolation flag.
      keepdim: whether to keep the output shape the same as input (True) or broadcast it
        to the batch form (False).
  
  Shape:
      - Input: :math:`(C, D, H, W)` or :math:`(B, C, D, H, W)`, Optional: :math:`(B, 4, 4)`
      - Output: :math:`(B, C, D, H, W)`
  
  Note:
      Input tensor must be float and normalized into [0, 1] for the best differentiability support.
      Additionally, this function accepts another transformation tensor (:math:`(B, 4, 4)`), then the
      applied transformation will be merged int to the input transformation tensor and returned.
  
  Examples:
      >>> import torch
      >>> rng = torch.manual_seed(0)
      >>> input = torch.rand(1, 1, 3, 3, 3)
      >>> aug = RandomRotation3D((15., 20., 20.), p=1.0)
      >>> aug(input), aug.transform_matrix
      (tensor([[[[[0.3819, 0.4886, 0.2111],
                 [0.1196, 0.3833, 0.4722],
                 [0.3432, 0.5951, 0.4223]],
      <BLANKLINE>
                [[0.5553, 0.4374, 0.2780],
                 [0.2423, 0.1689, 0.4009],
                 [0.4516, 0.6376, 0.7327]],
      <BLANKLINE>
                [[0.1605, 0.3112, 0.3673],
                 [0.4931, 0.4620, 0.5700],
                 [0.3505, 0.4685, 0.8092]]]]]), tensor([[[ 0.9722,  0.1131, -0.2049,  0.1196],
               [-0.0603,  0.9669,  0.2478, -0.1545],
               [ 0.2262, -0.2286,  0.9469,  0.0556],
               [ 0.0000,  0.0000,  0.0000,  1.0000]]]))
  
  To apply the exact augmenation again, you may take the advantage of the previous parameter state:
      >>> input = torch.rand(1, 3, 32, 32, 32)
      >>> aug = RandomRotation3D((15., 20., 20.), p=1.)
      >>> (aug(input) == aug(input, params=aug._params)).all()
      tensor(True)
class_docstr_tok: ["Apply","random","rotations","to","3D","volumes","(","5D","tensor",")",".","Input","should","be","a","tensor","of","shape","(","C",",","D",",","H",",","W",")","or","a","batch","of","tensors",":","math",":","`","(","B",",","C",",","D",",","H",",","W",")","`",".","If","Input","is","a","tuple","it","is","assumed","that","the","first","element","contains","the","aforementioned","tensors","and","the","second",",","the","corresponding","transformation","matrix","that","has","been","applied","to","them",".","In","this","case","the","module","will","rotate","the","tensors","and","concatenate","the","corresponding","transformation","matrix","to","the","previous","one",".","This","is","especially","useful","when","using","this","functionality","as","part","of","an","``","nn.Sequential","``","module",".","Args",":","degrees",":","Range","of","degrees","to","select","from",".","If","degrees","is","a","number",",","then","yaw",",","pitch",",","roll","will","be","generated","from","the","range","of","(","-degrees",",","+degrees",")",".","If","degrees","is","a","tuple","of","(","min",",","max",")",",","then","yaw",",","pitch",",","roll","will","be","generated","from","the","range","of","(","min",",","max",")",".","If","degrees","is","a","list","of","floats","[","a",",","b",",","c","]",",","then","yaw",",","pitch",",","roll","will","be","generated","from","(","-a",",","a",")",",","(","-b",",","b",")","and","(","-c",",","c",")",".","If","degrees","is","a","list","of","tuple","(","(","a",",","b",")",",","(","m",",","n",")",",","(","x",",","y",")",")",",","then","yaw",",","pitch",",","roll","will","be","generated","from","(","a",",","b",")",",","(","m",",","n",")","and","(","x",",","y",")",".","Set","to","0","to","deactivate","rotations",".","resample",":","resample","mode","from","``","nearest","''","(","0",")","or","``","bilinear","''","(","1",")",".","same_on_batch",":","apply","the","same","transformation","across","the","batch",".","align_corners",":","interpolation","flag",".","keepdim",":","whether","to","keep","the","output","shape","the","same","as","input","(","True",")","or","broadcast","it","to","the","batch","form","(","False",")",".","Shape",":","-","Input",":",":","math",":","`","(","C",",","D",",","H",",","W",")","`","or",":","math",":","`","(","B",",","C",",","D",",","H",",","W",")","`",",","Optional",":",":","math",":","`","(","B",",","4",",","4",")","`","-","Output",":",":","math",":","`","(","B",",","C",",","D",",","H",",","W",")","`","Note",":","Input","tensor","must","be","float","and","normalized","into","[","0",",","1","]","for","the","best","differentiability","support",".","Additionally",",","this","function","accepts","another","transformation","tensor","(",":","math",":","`","(","B",",","4",",","4",")","`",")",",","then","the","applied","transformation","will","be","merged","int","to","the","input","transformation","tensor","and","returned",".","Examples",":",">",">",">","import","torch",">",">",">","rng","=","torch.manual_seed","(","0",")",">",">",">","input","=","torch.rand","(","1",",","1",",","3",",","3",",","3",")",">",">",">","aug","=","RandomRotation3D","(","(","15.",",","20.",",","20",".",")",",","p=1.0",")",">",">",">","aug","(","input",")",",","aug.transform_matrix","(","tensor","(","[","[","[","[","[","0.3819",",","0.4886",",","0.2111","]",",","[","0.1196",",","0.3833",",","0.4722","]",",","[","0.3432",",","0.5951",",","0.4223","]","]",",","<","BLANKLINE",">","[","[","0.5553",",","0.4374",",","0.2780","]",",","[","0.2423",",","0.1689",",","0.4009","]",",","[","0.4516",",","0.6376",",","0.7327","]","]",",","<","BLANKLINE",">","[","[","0.1605",",","0.3112",",","0.3673","]",",","[","0.4931",",","0.4620",",","0.5700","]",",","[","0.3505",",","0.4685",",","0.8092","]","]","]","]","]",")",",","tensor","(","[","[","[","0.9722",",","0.1131",",","-0.2049",",","0.1196","]",",","[","-0.0603",",","0.9669",",","0.2478",",","-0.1545","]",",","[","0.2262",",","-0.2286",",","0.9469",",","0.0556","]",",","[","0.0000",",","0.0000",",","0.0000",",","1.0000","]","]","]",")",")","To","apply","the","exact","augmenation","again",",","you","may","take","the","advantage","of","the","previous","parameter","state",":",">",">",">","input","=","torch.rand","(","1",",","3",",","32",",","32",",","32",")",">",">",">","aug","=","RandomRotation3D","(","(","15.",",","20.",",","20",".",")",",","p=1",".",")",">",">",">","(","aug","(","input",")","==","aug","(","input",",","params=aug._params",")",")",".all","(",")","tensor","(","True",")"]
code: def apply_transform(
      self,
      input: Tensor,
      params: Dict[str, Tensor],
      flags: Dict[str, Any],
      transform: Optional[Tensor] = None,
  ) -> Tensor:
      if not isinstance(transform, Tensor):
          raise TypeError(
              f"Expected the transform to be a Tensor. Gotcha {type(transform)}"
          )
  
      return affine3d(
          input,
          transform[..., :3, :4],
          flags["resample"].name.lower(),
          "zeros",
          flags["align_corners"],
      )
  
file_path: kornia/kornia/augmentation/_3d/geometric/rotation.py
imports: from typing import Any, Dict, Optional, Tuple, Union
  import kornia
  from kornia.augmentation import random_generator
  from kornia.augmentation._3d.geometric.base import GeometricAugmentationBase3D
  from kornia.constants import Resample
  from kornia.core import Tensor
  from kornia.geometry import affine3d
  from kornia.geometry.transform.affwarp import _compute_rotation_matrix3d, _compute_tensor_center3d
label_desc: Use image node_id 3 for calling the RandomRotation3D obj's underlying member method code with example usage: obj.apply_transform(input, params, flags, transform) and returns: affine3d