code: def warp_affine3d(
      src: Tensor,
      M: Tensor,
      dsize: tuple[int, int, int],
      flags: str = "bilinear",
      padding_mode: str = "zeros",
      align_corners: bool = True,
  ) -> Tensor:
      r"""Apply a projective transformation a to 3d tensor.
  
      .. warning::
          This API signature it is experimental and might suffer some changes in the future.
  
      Args:
          src : input tensor of shape :math:`(B, C, D, H, W)`.
          M: projective transformation matrix of shape :math:`(B, 3, 4)`.
          dsize: size of the output image (depth, height, width).
          mode: interpolation mode to calculate output values
            ``'bilinear'`` | ``'nearest'``.
          padding_mode: padding mode for outside grid values
            ``'zeros'`` | ``'border'`` | ``'reflection'``.
          align_corners : mode for grid_generation.
  
      Returns:
          Tensor: the warped 3d tensor with shape :math:`(B, C, D, H, W)`.
  
      .. note::
          This function is often used in conjunction with :func:`get_perspective_transform3d`.
      """
      if len(src.shape) != 5:
          raise AssertionError(src.shape)
      if not (len(M.shape) == 3 and M.shape[-2:] == (3, 4)):
          raise AssertionError(M.shape)
      if len(dsize) != 3:
          raise AssertionError(dsize)
      B, C, D, H, W = src.size()
  
      size_src: tuple[int, int, int] = (D, H, W)
      size_out: tuple[int, int, int] = dsize
  
      M_4x4 = convert_affinematrix_to_homography3d(M)  # Bx4x4
  
      # we need to normalize the transformation since grid sample needs -1/1 coordinates
      dst_norm_trans_src_norm: Tensor = normalize_homography3d(
          M_4x4, size_src, size_out
      )  # Bx4x4
  
      src_norm_trans_dst_norm = _torch_inverse_cast(
          dst_norm_trans_src_norm
      )
      P_norm: Tensor = src_norm_trans_dst_norm[:, :3]  # Bx3x4
  
      # compute meshgrid and apply to input
      dsize_out: list[int] = [B, C, *list(size_out)]
      grid = F.affine_grid(
          P_norm, dsize_out, align_corners=align_corners
      )
      return F.grid_sample(
          src,
          grid,
          align_corners=align_corners,
          mode=flags,
          padding_mode=padding_mode,
      )
  
imports: from __future__ import annotations
  from typing import Optional
  import torch
  import torch.nn.functional
  from kornia.core import Tensor, concatenate, ones, ones_like, stack, tan, tensor, zeros
  from kornia.core.check import KORNIA_CHECK, KORNIA_CHECK_SHAPE
  from kornia.geometry.conversions import angle_to_rotation_matrix, axis_angle_to_rotation_matrix, convert_affinematrix_to_homography, convert_affinematrix_to_homography3d, deg2rad, normalize_homography, normalize_homography3d, normalize_pixel_coordinates
  from kornia.geometry.linalg import transform_points
  from kornia.utils import create_meshgrid, create_meshgrid3d, eye_like
  from kornia.utils.helpers import _torch_inverse_cast, _torch_solve_cast
label_desc: Use image node_id 16 for calling a global function with example usage: warp_affine3d(src, M, dsize, flags, padding_mode, align_corners) and returns: F