code: def match_adalam(
      desc1: Tensor,
      desc2: Tensor,
      lafs1: Tensor,
      lafs2: Tensor,
      config: Optional[AdalamConfig] = None,
      hw1: Optional[Tuple[int, int]] = None,
      hw2: Optional[Tuple[int, int]] = None,
      dm: Optional[Tensor] = None,
  ) -> Tuple[Tensor, Tensor]:
      """Function, which performs descriptor matching, followed by AdaLAM filtering (see :cite:`AdaLAM2020` for more
      details)
  
      If the distance matrix dm is not provided, :py:func:`torch.cdist` is used.
  
      Args:
          desc1: Batch of descriptors of a shape :math:`(B1, D)`.
          desc2: Batch of descriptors of a shape :math:`(B2, D)`.
          lafs1: LAFs of a shape :math:`(1, B1, 2, 3)`.
          lafs2: LAFs of a shape :math:`(1, B2, 2, 3)`.
          config: dict with AdaLAM config
          dm: Tensor containing the distances from each descriptor in desc1
            to each descriptor in desc2, shape of :math:`(B1, B2)`.
  
      Return:
          - Descriptor distance of matching descriptors, shape of :math:`(B3, 1)`.
          - Long tensor indexes of matching descriptors in desc1 and desc2. Shape: :math:`(B3, 2)`,
            where 0 <= B3 <= B1.
      """
      KORNIA_CHECK_SHAPE(desc1, ["B", "DIM"])
      KORNIA_CHECK_SHAPE(desc2, ["B", "DIM"])
      KORNIA_CHECK_LAF(lafs1)
      KORNIA_CHECK_LAF(lafs2)
      config_ = get_adalam_default_config()
      if config is None:
          config_["device"] = desc1.device
      else:
          config_ = get_adalam_default_config()
          for key, val in config.items():
              if key not in config_.keys():
                  print(
                      f"WARNING: custom configuration contains a key which is not recognized ({key}). "
                      f"Known configurations are {list(config_.keys())}."
                  )
                  continue
              # TypedDict does not support variable names. https://stackoverflow.com/a/59583427/1983544
              config_[key] = val  # type: ignore
      adalam_object = AdalamFilter(config_)
      idxs, quality = adalam_object.match_and_filter(
          get_laf_center(lafs1).reshape(-1, 2),
          get_laf_center(lafs2).reshape(-1, 2),
          desc1,
          desc2,
          hw1,
          hw2,
          get_laf_orientation(lafs1).reshape(-1),
          get_laf_orientation(lafs2).reshape(-1),
          get_laf_scale(lafs1).reshape(-1),
          get_laf_scale(lafs2).reshape(-1),
          return_dist=True,
      )
      return quality, idxs
  
file_path: kornia/kornia/feature/adalam/adalam.py
imports: from typing import Optional, Tuple, Union
  import torch
  from kornia.core import Tensor, as_tensor
  from kornia.core.check import KORNIA_CHECK_LAF, KORNIA_CHECK_SHAPE
  from kornia.feature.laf import get_laf_center, get_laf_orientation, get_laf_scale
  from .core import AdalamConfig, _no_match, adalam_core
  from .utils import dist_matrix
label_desc: Use image node_id 2 for calling a global function with example usage: match_adalam(desc1, desc2, lafs1, lafs2, config, hw1, hw2, dm) and returns: quality,  idxs