code: def get_affine_matrix2d(
      translations: Tensor,
      center: Tensor,
      scale: Tensor,
      angle: Tensor,
      sx: Optional[Tensor] = None,
      sy: Optional[Tensor] = None,
  ) -> Tensor:
      r"""Compose affine matrix from the components.
  
      Args:
          translations: tensor containing the translation vector with shape :math:`(B, 2)`.
          center: tensor containing the center vector with shape :math:`(B, 2)`.
          scale: tensor containing the scale factor with shape :math:`(B, 2)`.
          angle: tensor of angles in degrees :math:`(B)`.
          sx: tensor containing the shear factor in the x-direction with shape :math:`(B)`.
          sy: tensor containing the shear factor in the y-direction with shape :math:`(B)`.
  
      Returns:
          the affine transformation matrix :math:`(B, 3, 3)`.
  
      .. note::
          This function is often used in conjunction with :func:`warp_affine`, :func:`warp_perspective`.
      """
      transform: Tensor = get_rotation_matrix2d(center, -angle, scale)
      transform[..., 2] += translations  # tx/ty
  
      # pad transform to get Bx3x3
      transform_h = convert_affinematrix_to_homography(transform)
  
      if any(s is not None for s in [sx, sy]):
          shear_mat = get_shear_matrix2d(center, sx, sy)
          transform_h = transform_h @ shear_mat
  
      return transform_h
  
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 10 for calling a global function with example usage: get_affine_matrix2d(translations, center, scale, angle, sx, sy) and returns: transform_h