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: Produce additional matches for predictions that have only low-quality matches.
  Specifically, for each ground-truth find the set of predictions that have
  maximum overlap with it (including ties); for each prediction in that set, if
  it is unmatched, then match it to the ground-truth with which it has the highest
  quality value.
docstr_tok: ["Produce","additional","matches","for","predictions","that","have","only","low-quality","matches",".","Specifically",",","for","each","ground-truth","find","the","set","of","predictions","that","have","maximum","overlap","with","it","(","including","ties",")",";","for","each","prediction","in","that","set",",","if","it","is","unmatched",",","then","match","it","to","the","ground-truth","with","which","it","has","the","highest","quality","value","."]
code: def set_low_quality_matches_(
      self,
      matches: Tensor,
      all_matches: Tensor,
      match_quality_matrix: Tensor,
  ) -> None:
      """
      Produce additional matches for predictions that have only low-quality matches.
      Specifically, for each ground-truth find the set of predictions that have
      maximum overlap with it (including ties); for each prediction in that set, if
      it is unmatched, then match it to the ground-truth with which it has the highest
      quality value.
      """
      # For each gt, find the prediction with which it has the highest quality
      highest_quality_foreach_gt, _ = match_quality_matrix.max(dim=1)
      # Find the highest quality match available, even if it is low, including ties
      gt_pred_pairs_of_highest_quality = torch.where(
          match_quality_matrix == highest_quality_foreach_gt[:, None]
      )
      # Example gt_pred_pairs_of_highest_quality:
      # (tensor([0, 1, 1, 2, 2, 3, 3, 4, 5, 5]),
      #  tensor([39796, 32055, 32070, 39190, 40255, 40390, 41455, 45470, 45325, 46390]))
      # Each element in the first tensor is a gt index, and each element in second tensor is a prediction index
      # Note how gt items 1, 2, 3, and 5 each have two ties
  
      pred_inds_to_update = gt_pred_pairs_of_highest_quality[1]
      matches[pred_inds_to_update] = all_matches[pred_inds_to_update]
  
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 3 for calling the Matcher obj's underlying member method code with example usage: obj.set_low_quality_matches_(matches, all_matches, match_quality_matrix) without return types