code: def get_tps_transform(
      points_src: torch.Tensor, points_dst: torch.Tensor
  ) -> tuple[torch.Tensor, torch.Tensor]:
      r"""Compute the TPS transform parameters that warp source points to target points.
  
      The input to this function is a tensor of :math:`(x, y)` source points :math:`(B, N, 2)` and a corresponding
      tensor of target :math:`(x, y)` points :math:`(B, N, 2)`.
  
      Args:
          points_src: batch of source points :math:`(B, N, 2)` as :math:`(x, y)` coordinate vectors.
          points_dst: batch of target points :math:`(B, N, 2)` as :math:`(x, y)` coordinate vectors.
  
      Returns:
          :math:`(B, N, 2)` tensor of kernel weights and :math:`(B, 3, 2)`
              tensor of affine weights. The last dimension contains the x-transform and y-transform weights
              as separate columns.
  
      Example:
          >>> points_src = torch.rand(1, 5, 2)
          >>> points_dst = torch.rand(1, 5, 2)
          >>> kernel_weights, affine_weights = get_tps_transform(points_src, points_dst)
  
      .. note::
          This function is often used in conjunction with :func:`warp_points_tps`, :func:`warp_image_tps`.
      """
      if not isinstance(points_src, torch.Tensor):
          raise TypeError(
              f"Input points_src is not torch.Tensor. Got {type(points_src)}"
          )
  
      if not isinstance(points_dst, torch.Tensor):
          raise TypeError(
              f"Input points_dst is not torch.Tensor. Got {type(points_dst)}"
          )
  
      if not len(points_src.shape) == 3:
          raise ValueError(
              f"Invalid shape for points_src, expected BxNx2. Got {points_src.shape}"
          )
  
      if not len(points_dst.shape) == 3:
          raise ValueError(
              f"Invalid shape for points_dst, expected BxNx2. Got {points_dst.shape}"
          )
  
      device, dtype = points_src.device, points_src.dtype
      batch_size, num_points = points_src.shape[:2]
  
      # set up and solve linear system
      # [K   P] [w] = [dst]
      # [P^T 0] [a]   [ 0 ]
      pair_distance: torch.Tensor = _pair_square_euclidean(
          points_src, points_dst
      )
      k_matrix: torch.Tensor = _kernel_distance(pair_distance)
  
      zero_mat: torch.Tensor = zeros(
          batch_size, 3, 3, device=device, dtype=dtype
      )
      one_mat: torch.Tensor = ones(
          batch_size, num_points, 1, device=device, dtype=dtype
      )
      dest_with_zeros: torch.Tensor = torch.cat(
          (points_dst, zero_mat[:, :, :2]), 1
      )
      p_matrix: torch.Tensor = torch.cat((one_mat, points_src), -1)
      p_matrix_t: torch.Tensor = torch.cat(
          (p_matrix, zero_mat), 1
      ).transpose(1, 2)
      l_matrix: torch.Tensor = torch.cat((k_matrix, p_matrix), -1)
      l_matrix = torch.cat((l_matrix, p_matrix_t), 1)
  
      weights = _torch_solve_cast(l_matrix, dest_with_zeros)
      kernel_weights: torch.Tensor = weights[:, :-3]
      affine_weights: torch.Tensor = weights[:, -3:]
  
      return kernel_weights, affine_weights
  
file_path: kornia/kornia/geometry/transform/thin_plate_spline.py
imports: from __future__ import annotations
  import torch
  from torch import nn
  from kornia.core import ones, zeros
  from kornia.utils import create_meshgrid
  from kornia.utils.helpers import _torch_solve_cast
label_desc: Use image node_id 3 for calling a global function with example usage: get_tps_transform(points_src, points_dst) and returns: kernel_weights,  affine_weights