code: def decompose_essential_matrix(
      E_mat: torch.Tensor,
  ) -> Tuple[torch.Tensor, torch.Tensor, torch.Tensor]:
      r"""Decompose an essential matrix to possible rotations and translation.
  
      This function decomposes the essential matrix E using svd decomposition [96]
      and give the possible solutions: :math:`R1, R2, t`.
  
      Args:
         E_mat: The essential matrix in the form of :math:`(*, 3, 3)`.
  
      Returns:
         A tuple containing the first and second possible rotation matrices and the translation vector.
         The shape of the tensors with be same input :math:`[(*, 3, 3), (*, 3, 3), (*, 3, 1)]`.
      """
      if not (len(E_mat.shape) >= 2 and E_mat.shape[-2:]):
          raise AssertionError(E_mat.shape)
  
      # decompose matrix by its singular values
      U, _, V = _torch_svd_cast(E_mat)
      Vt = V.transpose(-2, -1)
  
      mask = ones_like(E_mat)
      mask[..., -1:] *= -1.0  # fill last column with negative values
  
      maskt = mask.transpose(-2, -1)
  
      # avoid singularities
      U = where((torch.det(U) < 0.0)[..., None, None], U * mask, U)
      Vt = where((torch.det(Vt) < 0.0)[..., None, None], Vt * maskt, Vt)
  
      W = cross_product_matrix(
          torch.tensor([[0.0, 0.0, 1.0]]).type_as(E_mat)
      )
      W[..., 2, 2] += 1.0
  
      # reconstruct rotations and retrieve translation vector
      U_W_Vt = U @ W @ Vt
      U_Wt_Vt = U @ W.transpose(-2, -1) @ Vt
  
      # return values
      R1 = U_W_Vt
      R2 = U_Wt_Vt
      T = U[..., -1:]
      return (R1, R2, T)
  
file_path: kornia/kornia/geometry/epipolar/essential.py
imports: from typing import Optional, Tuple
  import torch
  import kornia.geometry.epipolar
  from kornia.core import eye, ones_like, stack, where, zeros
  from kornia.core.check import KORNIA_CHECK, KORNIA_CHECK_SAME_SHAPE, KORNIA_CHECK_SHAPE
  from kornia.geometry import solvers
  from kornia.utils import eye_like, vec_like
  from kornia.utils.helpers import _torch_svd_cast
  from .numeric import cross_product_matrix
  from .projection import depth_from_point, projection_from_KRt
  from .triangulation import triangulate_points
label_desc: Use image node_id 3 for calling a global function with example usage: decompose_essential_matrix(E_mat) and returns: R1,  R2,  T