class_docstr: This class assigns to each predicted "element" (e.g., a box) a ground-truth
  element. Each predicted element will have exactly zero or one matches; each
  ground-truth element may be assigned to zero or more predicted elements.
  
  Matching is based on the MxN match_quality_matrix, that characterizes how well
  each (ground-truth, predicted)-pair match. For example, if the elements are
  boxes, the matrix may contain box IoU overlap values.
  
  The matcher returns a tensor of size N containing the index of the ground-truth
  element m that matches to prediction n. If there is no match, a negative value
  is returned.
class_docstr_tok: ["This","class","assigns","to","each","predicted","``","element","''","(","e.g.",",","a","box",")","a","ground-truth","element",".","Each","predicted","element","will","have","exactly","zero","or","one","matches",";","each","ground-truth","element","may","be","assigned","to","zero","or","more","predicted","elements",".","Matching","is","based","on","the","MxN","match_quality_matrix",",","that","characterizes","how","well","each","(","ground-truth",",","predicted",")","-pair","match",".","For","example",",","if","the","elements","are","boxes",",","the","matrix","may","contain","box","IoU","overlap","values",".","The","matcher","returns","a","tensor","of","size","N","containing","the","index","of","the","ground-truth","element","m","that","matches","to","prediction","n.","If","there","is","no","match",",","a","negative","value","is","returned","."]
docstr: Args:
      match_quality_matrix (Tensor[float]): an MxN tensor, containing the
      pairwise quality between M ground-truth elements and N predicted elements.
  
  Returns:
      matches (Tensor[int64]): an N tensor where N[i] is a matched gt in
      [0, M - 1] or a negative value indicating that prediction i could not
      be matched.
docstr_tok: ["Args",":","match_quality_matrix","(","Tensor","[","float","]",")",":","an","MxN","tensor",",","containing","the","pairwise","quality","between","M","ground-truth","elements","and","N","predicted","elements",".","Returns",":","matches","(","Tensor","[","int64","]",")",":","an","N","tensor","where","N","[","i","]","is","a","matched","gt","in","[","0",",","M","-","1","]","or","a","negative","value","indicating","that","prediction","i","could","not","be","matched","."]
code: def __call__(self, match_quality_matrix: Tensor) -> Tensor:
      """
      Args:
          match_quality_matrix (Tensor[float]): an MxN tensor, containing the
          pairwise quality between M ground-truth elements and N predicted elements.
  
      Returns:
          matches (Tensor[int64]): an N tensor where N[i] is a matched gt in
          [0, M - 1] or a negative value indicating that prediction i could not
          be matched.
      """
      if match_quality_matrix.numel() == 0:
          # empty targets or proposals not supported during training
          if match_quality_matrix.shape[0] == 0:
              raise ValueError(
                  "No ground-truth boxes available for one of the images during training"
              )
          else:
              raise ValueError(
                  "No proposal boxes available for one of the images during training"
              )
  
      # match_quality_matrix is M (gt) x N (predicted)
      # Max over gt elements (dim 0) to find best gt candidate for each prediction
      matched_vals, matches = match_quality_matrix.max(dim=0)
      if self.allow_low_quality_matches:
          all_matches = matches.clone()
      else:
          all_matches = None  # type: ignore[assignment]
  
      # Assign candidate matches with low quality to negative (unassigned) values
      below_low_threshold = matched_vals < self.low_threshold
      between_thresholds = (matched_vals >= self.low_threshold) & (
          matched_vals < self.high_threshold
      )
      matches[below_low_threshold] = self.BELOW_LOW_THRESHOLD
      matches[between_thresholds] = self.BETWEEN_THRESHOLDS
  
      if self.allow_low_quality_matches:
          if all_matches is None:
              torch._assert(False, "all_matches should not be None")
          else:
              self.set_low_quality_matches_(
                  matches, all_matches, match_quality_matrix
              )
  
      return matches
  
imports: import math
  from collections import OrderedDict
  from typing import Dict, List, Optional, Tuple
  import torch
  from torch import nn, Tensor
  from torch.nn import functional
  from torchvision.ops import complete_box_iou_loss, distance_box_iou_loss, FrozenBatchNorm2d, generalized_box_iou_loss
label_desc: Use image node_id 2 for calling the Matcher obj's underlying member method code with example usage: obj.__call__(match_quality_matrix) and returns: matches