code: def _pair_square_euclidean(
      tensor1: torch.Tensor, tensor2: torch.Tensor
  ) -> torch.Tensor:
      r"""Compute the pairwise squared euclidean distance matrices :math:`(B, N, M)` between two tensors with shapes
      (B, N, C) and (B, M, C)."""
      # ||t1-t2||^2 = (t1-t2)^T(t1-t2) = t1^T*t1 + t2^T*t2 - 2*t1^T*t2
      t1_sq: torch.Tensor = tensor1.mul(tensor1).sum(
          dim=-1, keepdim=True
      )
      t2_sq: torch.Tensor = (
          tensor2.mul(tensor2).sum(dim=-1, keepdim=True).transpose(1, 2)
      )
      t1_t2: torch.Tensor = tensor1.matmul(tensor2.transpose(1, 2))
      square_dist: torch.Tensor = -2 * t1_t2 + t1_sq + t2_sq
      square_dist = square_dist.clamp(
          min=0
      )  # handle possible numerical errors
      return square_dist
  
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 1 for calling a global function with example usage: _pair_square_euclidean(tensor1, tensor2) and returns: square_dist