code: def rotate3d(
      tensor: torch.Tensor,
      yaw: torch.Tensor,
      pitch: torch.Tensor,
      roll: torch.Tensor,
      center: Union[None, torch.Tensor] = None,
      mode: str = "bilinear",
      padding_mode: str = "zeros",
      align_corners: bool = False,
  ) -> torch.Tensor:
      r"""Rotate 3D the tensor anti-clockwise about the centre.
  
      Args:
          tensor: The image tensor to be warped in shapes of :math:`(B, C, D, H, W)`.
          yaw: The yaw angle through which to rotate. The tensor
            must have a shape of (B), where B is batch size.
          pitch: The pitch angle through which to rotate. The tensor
            must have a shape of (B), where B is batch size.
          roll: The roll angle through which to rotate. The tensor
            must have a shape of (B), where B is batch size.
          center: The center through which to rotate. The tensor
            must have a shape of (B, 2), where B is batch size and last
            dimension contains cx and cy.
          mode: interpolation mode to calculate output values
            ``'bilinear'`` | ``'nearest'``.
          padding_mode: padding mode for outside grid values
            ``'zeros'`` | ``'border'`` | ``'reflection'``.
          align_corners: interpolation flag.
  
      Returns:
          torch.Tensor: The rotated tensor with shape as input.
      """
      if not isinstance(tensor, torch.Tensor):
          raise TypeError(
              f"Input tensor type is not a torch.Tensor. Got {type(tensor)}"
          )
  
      if not isinstance(yaw, torch.Tensor):
          raise TypeError(f"yaw is not a torch.Tensor. Got {type(yaw)}")
  
      if not isinstance(pitch, torch.Tensor):
          raise TypeError(
              f"pitch is not a torch.Tensor. Got {type(pitch)}"
          )
  
      if not isinstance(roll, torch.Tensor):
          raise TypeError(
              f"roll is not a torch.Tensor. Got {type(roll)}"
          )
  
      if center is not None and not isinstance(center, torch.Tensor):
          raise TypeError(
              f"Input center type is not a torch.Tensor. Got {type(center)}"
          )
  
      if len(tensor.shape) not in (4, 5):
          raise ValueError(
              f"Invalid tensor shape, we expect CxDxHxW or BxCxDxHxW. Got: {tensor.shape}"
          )
  
      # compute the rotation center
      if center is None:
          center = _compute_tensor_center3d(tensor)
  
      # compute the rotation matrix
      # TODO: add broadcasting to get_rotation_matrix2d for center
      yaw = yaw.expand(tensor.shape[0])
      pitch = pitch.expand(tensor.shape[0])
      roll = roll.expand(tensor.shape[0])
      center = center.expand(tensor.shape[0], -1)
      rotation_matrix: torch.Tensor = _compute_rotation_matrix3d(
          yaw, pitch, roll, center
      )
  
      # warp using the affine transform
      return affine3d(
          tensor,
          rotation_matrix[..., :3, :4],
          mode,
          padding_mode,
          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 11 for calling a global function with example usage: rotate3d(tensor, yaw, pitch, roll, center, mode, padding_mode, align_corners) and returns: affine3d