code: def find_essential(
      points1: torch.Tensor,
      points2: torch.Tensor,
      weights: Optional[torch.Tensor] = None,
  ) -> torch.Tensor:
      r"""
      Args:
          points1: A set of points in the first image with a tensor shape :math:`(B, N, 2), N>=5`.
          points2: A set of points in the second image with a tensor shape :math:`(B, N, 2), N>=5`.
          weights: Tensor containing the weights per point correspondence with a shape of :math:`(5, N)`.
  
      Returns:
          the computed essential matrix with shape :math:`(B, 3, 3)`,
          one model for each batch selected out of ten solutions by Sampson distances.
  
      """
      E = run_5point(points1, points2, weights).to(points1.dtype)
  
      # select one out of 10 possible solutions from 5PC Nister solver.
      solution_num = 10
      batch_size = points1.shape[0]
  
      error = zeros((batch_size, solution_num))
  
      for b in range(batch_size):
          error[b] = epi.sampson_epipolar_distance(
              points1[b],
              points2[b],
              E.view(batch_size, solution_num, 3, 3)[b],
          ).sum(-1)
  
      KORNIA_CHECK_SHAPE(error, ["f{batch_size}", "10"])
  
      chosen_indices = torch.argmin(error, dim=-1)
      result = stack(
          [
              (E.view(-1, solution_num, 3, 3))[i, chosen_indices[i], :]
              for i in range(batch_size)
          ]
      )
  
      return result
  
file_path: kornia/kornia/geometry/epipolar/essential.py
imports: from typing import Optional, Tuple
  import torch
  import kornia.geometry.epipolar
  from kornia.core import eye, ones_like, stack, where, zeros
  from kornia.core.check import KORNIA_CHECK, KORNIA_CHECK_SAME_SHAPE, KORNIA_CHECK_SHAPE
  from kornia.geometry import solvers
  from kornia.utils import eye_like, vec_like
  from kornia.utils.helpers import _torch_svd_cast
  from .numeric import cross_product_matrix
  from .projection import depth_from_point, projection_from_KRt
  from .triangulation import triangulate_points
label_desc: Use image node_id 8 for calling a global function with example usage: find_essential(points1, points2, weights) and returns: result