code: def run_8point(
      points1: Tensor, points2: Tensor, weights: Optional[Tensor] = None
  ) -> Tensor:
      r"""Compute the fundamental matrix using the DLT formulation.
  
      The linear system is solved by using the Weighted Least Squares Solution for the 8 Points algorithm.
  
      Args:
          points1: A set of points in the first image with a tensor shape :math:`(B, N, 2), N>=8`.
          points2: A set of points in the second image with a tensor shape :math:`(B, N, 2), N>=8`.
          weights: Tensor containing the weights per point correspondence with a shape of :math:`(B, N)`.
  
      Returns:
          the computed fundamental matrix with shape :math:`(B, 3, 3)`.
      """
      if points1.shape != points2.shape:
          raise AssertionError(points1.shape, points2.shape)
      if points1.shape[1] < 8:
          raise AssertionError(points1.shape)
      if weights is not None:
          if not (
              len(weights.shape) == 2
              and weights.shape[1] == points1.shape[1]
          ):
              raise AssertionError(weights.shape)
  
      points1_norm, transform1 = normalize_points(points1)
      points2_norm, transform2 = normalize_points(points2)
  
      x1, y1 = torch.chunk(points1_norm, dim=-1, chunks=2)  # Bx1xN
      x2, y2 = torch.chunk(points2_norm, dim=-1, chunks=2)  # Bx1xN
  
      ones = ones_like(x1)
  
      # build equations system and solve DLT
      # https://www.cc.gatech.edu/~afb/classes/CS4495-Fall2013/slides/CS4495-09-TwoViews-2.pdf
      # [x * x', x * y', x, y * x', y * y', y, x', y', 1]
  
      X = torch.cat(
          [x2 * x1, x2 * y1, x2, y2 * x1, y2 * y1, y2, x1, y1, ones],
          dim=-1,
      )  # BxNx9
  
      # apply the weights to the linear system
      if weights is None:
          X = X.transpose(-2, -1) @ X
      else:
          w_diag = torch.diag_embed(weights)
          X = X.transpose(-2, -1) @ w_diag @ X
      # compute eigevectors and retrieve the one with the smallest eigenvalue
  
      _, _, V = _torch_svd_cast(X)
      F_mat = V[..., -1].view(-1, 3, 3)
  
      # reconstruct and force the matrix to have rank2
      U, S, V = _torch_svd_cast(F_mat)
      rank_mask = torch.tensor(
          [1.0, 1.0, 0.0], device=F_mat.device, dtype=F_mat.dtype
      )
  
      F_projected = U @ (
          torch.diag_embed(S * rank_mask) @ V.transpose(-2, -1)
      )
      F_est = transform2.transpose(-2, -1) @ (F_projected @ transform1)
  
      return normalize_transformation(F_est)
  
file_path: kornia/kornia/geometry/epipolar/fundamental.py
imports: from typing import Literal, Optional, Tuple
  import torch
  from kornia.core import Tensor, concatenate, ones_like, stack, where, zeros
  from kornia.core.check import KORNIA_CHECK_SHAPE
  from kornia.geometry.conversions import convert_points_from_homogeneous, convert_points_to_homogeneous
  from kornia.geometry.linalg import transform_points
  from kornia.geometry.solvers import solve_cubic
  from kornia.utils.helpers import _torch_svd_cast
label_desc: Use image node_id 4 for calling a global function with example usage: run_8point(points1, points2, weights) and returns: normalize_transformation