code: def compose_transformations(
      trans_01: Tensor, trans_12: Tensor
  ) -> Tensor:
      r"""Function that composes two homogeneous transformations.
  
      .. math::
          T_0^{2} = \begin{bmatrix} R_0^1 R_1^{2} & R_0^{1} t_1^{2} + t_0^{1} \\
          \mathbf{0} & 1\end{bmatrix}
  
      Args:
          trans_01: tensor with the homogeneous transformation from
            a reference frame 1 respect to a frame 0. The tensor has must have a
            shape of :math:`(N, 4, 4)` or :math:`(4, 4)`.
          trans_12: tensor with the homogeneous transformation from
            a reference frame 2 respect to a frame 1. The tensor has must have a
            shape of :math:`(N, 4, 4)` or :math:`(4, 4)`.
  
      Returns:
          the transformation between the two frames with shape :math:`(N, 4, 4)` or :math:`(4, 4)`.
  
      Example::
          >>> trans_01 = torch.eye(4)  # 4x4
          >>> trans_12 = torch.eye(4)  # 4x4
          >>> trans_02 = compose_transformations(trans_01, trans_12)  # 4x4
      """
      KORNIA_CHECK_IS_TENSOR(trans_01)
      KORNIA_CHECK_IS_TENSOR(trans_12)
  
      if not (
          (trans_01.dim() in (2, 3)) and (trans_01.shape[-2:] == (4, 4))
      ):
          raise ValueError(
              f"Input trans_01 must be a of the shape Nx4x4 or 4x4. Got {trans_01.shape}"
          )
  
      if not (
          (trans_12.dim() in (2, 3)) and (trans_12.shape[-2:] == (4, 4))
      ):
          raise ValueError(
              f"Input trans_12 must be a of the shape Nx4x4 or 4x4. Got {trans_12.shape}"
          )
  
      if not trans_01.dim() == trans_12.dim():
          raise ValueError(
              f"Input number of dims must match. Got {trans_01.dim()} and {trans_12.dim()}"
          )
  
      # unpack input data
      rmat_01: Tensor = trans_01[..., :3, :3]  # Nx3x3
      rmat_12: Tensor = trans_12[..., :3, :3]  # Nx3x3
      tvec_01: Tensor = trans_01[..., :3, -1:]  # Nx3x1
      tvec_12: Tensor = trans_12[..., :3, -1:]  # Nx3x1
  
      # compute the actual transforms composition
      rmat_02: Tensor = torch.matmul(rmat_01, rmat_12)
      tvec_02: Tensor = torch.matmul(rmat_01, tvec_12) + tvec_01
  
      # pack output tensor
      trans_02: Tensor = zeros_like(trans_01)
      trans_02[..., :3, 0:3] += rmat_02
      trans_02[..., :3, -1:] += tvec_02
      trans_02[..., -1, -1:] += 1.0
      return trans_02
  
file_path: kornia/kornia/geometry/linalg.py
imports: from __future__ import annotations
  import torch
  from kornia.core import Tensor, zeros_like
  from kornia.core.check import KORNIA_CHECK, KORNIA_CHECK_IS_TENSOR, KORNIA_CHECK_SHAPE
  from kornia.geometry.conversions import convert_points_from_homogeneous, convert_points_to_homogeneous
label_desc: Use image node_id 1 for calling a global function with example usage: compose_transformations(trans_01, trans_12) and returns: trans_02