code: def get_rotation_matrix2d(
      center: Tensor, angle: Tensor, scale: Tensor
  ) -> Tensor:
      r"""Calculate an affine matrix of 2D rotation.
  
      The function calculates the following matrix:
  
      .. math::
          \begin{bmatrix}
              \alpha & \beta & (1 - \alpha) \cdot \text{x}
              - \beta \cdot \text{y} \\
              -\beta & \alpha & \beta \cdot \text{x}
              + (1 - \alpha) \cdot \text{y}
          \end{bmatrix}
  
      where
  
      .. math::
          \alpha = \text{scale} \cdot cos(\text{angle}) \\
          \beta = \text{scale} \cdot sin(\text{angle})
  
      The transformation maps the rotation center to itself
      If this is not the target, adjust the shift.
  
      Args:
          center: center of the rotation in the source image with shape :math:`(B, 2)`.
          angle: rotation angle in degrees. Positive values mean
              counter-clockwise rotation (the coordinate origin is assumed to
              be the top-left corner) with shape :math:`(B)`.
          scale: scale factor for x, y scaling with shape :math:`(B, 2)`.
  
      Returns:
          the affine matrix of 2D rotation with shape :math:`(B, 2, 3)`.
  
      Example:
          >>> center = zeros(1, 2)
          >>> scale = torch.ones((1, 2))
          >>> angle = 45. * torch.ones(1)
          >>> get_rotation_matrix2d(center, angle, scale)
          tensor([[[ 0.7071,  0.7071,  0.0000],
                   [-0.7071,  0.7071,  0.0000]]])
  
      .. note::
          This function is often used in conjunction with :func:`warp_affine`.
      """
      if not isinstance(center, Tensor):
          raise TypeError(
              f"Input center type is not a Tensor. Got {type(center)}"
          )
  
      if not isinstance(angle, Tensor):
          raise TypeError(
              f"Input angle type is not a Tensor. Got {type(angle)}"
          )
  
      if not isinstance(scale, Tensor):
          raise TypeError(
              f"Input scale type is not a Tensor. Got {type(scale)}"
          )
  
      if not (len(center.shape) == 2 and center.shape[1] == 2):
          raise ValueError(
              f"Input center must be a Bx2 tensor. Got {center.shape}"
          )
  
      if not len(angle.shape) == 1:
          raise ValueError(
              f"Input angle must be a B tensor. Got {angle.shape}"
          )
  
      if not (len(scale.shape) == 2 and scale.shape[1] == 2):
          raise ValueError(
              f"Input scale must be a Bx2 tensor. Got {scale.shape}"
          )
  
      if not (center.shape[0] == angle.shape[0] == scale.shape[0]):
          raise ValueError(
              "Inputs must have same batch size dimension. Got center {}, angle {} and scale {}".format(
                  center.shape, angle.shape, scale.shape
              )
          )
  
      if not (center.device == angle.device == scale.device) or not (
          center.dtype == angle.dtype == scale.dtype
      ):
          raise ValueError(
              "Inputs must have same device Got center ({}, {}), angle ({}, {}) and scale ({}, {})".format(
                  center.device,
                  center.dtype,
                  angle.device,
                  angle.dtype,
                  scale.device,
                  scale.dtype,
              )
          )
  
      shift_m = eye_like(3, center)
      shift_m[:, :2, 2] = center
  
      shift_m_inv = eye_like(3, center)
      shift_m_inv[:, :2, 2] = -center
  
      scale_m = eye_like(3, center)
      scale_m[:, 0, 0] *= scale[:, 0]
      scale_m[:, 1, 1] *= scale[:, 1]
  
      rotat_m = eye_like(3, center)
      rotat_m[:, :2, :2] = angle_to_rotation_matrix(angle)
  
      affine_m = shift_m @ rotat_m @ scale_m @ shift_m_inv
      return affine_m[:, :2, :]
  
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 7 for calling a global function with example usage: get_rotation_matrix2d(center, angle, scale) and returns: affine_m