class_docstr: Wrapper for loading LightGlue-ONNX models and running inference via ONNXRuntime.
  
  LightGlue :cite:`LightGlue2023` performs fast descriptor-based deep keypoint matching.
  This module requires `onnxruntime` to be installed.
  
  If you have trained your own LightGlue model, see https://github.com/fabio-sim/LightGlue-ONNX
  for how to export the model to ONNX and optimize it.
  
  Args:
      weights: Pretrained weights, or a path to your own exported ONNX model. Available pretrained weights
        are ``'disk'``, ``'superpoint'``, ``'disk_fp16'``, and ``'superpoint_fp16'``. `Note that FP16 requires CUDA.`
        Defaults to ``'disk_fp16'`` if ``device`` is CUDA, and ``'disk'`` if CPU.
      device: Device to run inference on.
code: def __init__(
      self, weights: str | None = None, device: Device = "cpu"
  ) -> None:
      KORNIA_CHECK(ort is not None, "onnxruntime is not installed.")
      KORNIA_CHECK(np is not None, "numpy is not installed.")
  
      device = torch.device(device)  # type: ignore
      self.device = device
  
      if device.type == "cpu":
          providers = ["CPUExecutionProvider"]
      elif device.type == "cuda":
          providers = ["CUDAExecutionProvider", "CPUExecutionProvider"]
      else:
          raise ValueError(f"Unsupported device {device}")
  
      if weights is None:
          weights = "disk_fp16" if device.type == "cuda" else "disk"
  
      if weights in self.MODEL_URLS:
          if "fp16" in weights:
              KORNIA_CHECK(device.type == "cuda", "FP16 requires CUDA.")
  
          url = self.MODEL_URLS[weights]
          if device.type == "cpu":
              url = url.replace(".onnx", "_cpu.onnx")
  
          weights = download_onnx_from_url(url)
  
      self.session = ort.InferenceSession(weights, providers=providers)
  
file_path: kornia/kornia/feature/lightglue_onnx/lightglue.py
imports: from __future__ import annotations
  from typing import ClassVar
  import torch
  from kornia.core import Device, Tensor
  from kornia.core.check import KORNIA_CHECK, KORNIA_CHECK_SAME_DEVICES, KORNIA_CHECK_SHAPE
  from .utils import download_onnx_from_url, normalize_keypoints
label_desc: Use image node_id 1 to create a new OnnxLightGlue object  with example: obj = OnnxLightGlue(weights, device)