class_docstr: The quasi-dense roi embed head.
  
  Args:
      embed_channels (int): The input channel of embed features.
          Defaults to 256.
      softmax_temp (int): Softmax temperature. Defaults to -1.
      loss_track (dict): The loss function for tracking. Defaults to
          MultiPosCrossEntropyLoss.
      loss_track_aux (dict): The auxiliary loss function for tracking.
          Defaults to MarginL2Loss.
      init_cfg (:obj:`ConfigDict` or dict or list[:obj:`ConfigDict` or             dict]): Initialization config dict.
class_docstr_tok: ["The","quasi-dense","roi","embed","head",".","Args",":","embed_channels","(","int",")",":","The","input","channel","of","embed","features",".","Defaults","to","256.","softmax_temp","(","int",")",":","Softmax","temperature",".","Defaults","to","-1.","loss_track","(","dict",")",":","The","loss","function","for","tracking",".","Defaults","to","MultiPosCrossEntropyLoss",".","loss_track_aux","(","dict",")",":","The","auxiliary","loss","function","for","tracking",".","Defaults","to","MarginL2Loss",".","init_cfg","(",":","obj",":","`","ConfigDict","`","or","dict","or","list","[",":","obj",":","`","ConfigDict","`","or","dict","]",")",":","Initialization","config","dict","."]
docstr: Calculate the track targets and track weights for all samples in a
  batch according to the sampling_results.
  
  Args:
      gt_match_indices (list(Tensor)): Mapping from gt_instance_ids to
          ref_gt_instance_ids of the same tracklet in a pair of images.
      key_sampling_results (List[obj:SamplingResult]): Assign results of
          all images in a batch after sampling.
      ref_sampling_results (List[obj:SamplingResult]): Assign results of
          all reference images in a batch after sampling.
  
  Returns:
      Tuple[list[Tensor]]: Association results.
      Containing the following list of Tensors:
  
          - track_targets (list[Tensor]): The mapping instance ids from
              all positive proposals in the key image to all proposals
              in the reference image, each tensor in list has
              shape (len(key_pos_bboxes), len(ref_bboxes)).
          - track_weights (list[Tensor]): Loss weights for all positive
              proposals in a batch, each tensor in list has
              shape (len(key_pos_bboxes),).
docstr_tok: ["Calculate","the","track","targets","and","track","weights","for","all","samples","in","a","batch","according","to","the","sampling_results",".","Args",":","gt_match_indices","(","list","(","Tensor",")",")",":","Mapping","from","gt_instance_ids","to","ref_gt_instance_ids","of","the","same","tracklet","in","a","pair","of","images",".","key_sampling_results","(","List","[","obj",":","SamplingResult","]",")",":","Assign","results","of","all","images","in","a","batch","after","sampling",".","ref_sampling_results","(","List","[","obj",":","SamplingResult","]",")",":","Assign","results","of","all","reference","images","in","a","batch","after","sampling",".","Returns",":","Tuple","[","list","[","Tensor","]","]",":","Association","results",".","Containing","the","following","list","of","Tensors",":","-","track_targets","(","list","[","Tensor","]",")",":","The","mapping","instance","ids","from","all","positive","proposals","in","the","key","image","to","all","proposals","in","the","reference","image",",","each","tensor","in","list","has","shape","(","len","(","key_pos_bboxes",")",",","len","(","ref_bboxes",")",")",".","-","track_weights","(","list","[","Tensor","]",")",":","Loss","weights","for","all","positive","proposals","in","a","batch",",","each","tensor","in","list","has","shape","(","len","(","key_pos_bboxes",")",",",")","."]
code: def get_targets(
      self,
      gt_match_indices: List[Tensor],
      key_sampling_results: List[SamplingResult],
      ref_sampling_results: List[SamplingResult],
  ) -> Tuple[List, List]:
      """Calculate the track targets and track weights for all samples in a
      batch according to the sampling_results.
  
      Args:
          gt_match_indices (list(Tensor)): Mapping from gt_instance_ids to
              ref_gt_instance_ids of the same tracklet in a pair of images.
          key_sampling_results (List[obj:SamplingResult]): Assign results of
              all images in a batch after sampling.
          ref_sampling_results (List[obj:SamplingResult]): Assign results of
              all reference images in a batch after sampling.
  
      Returns:
          Tuple[list[Tensor]]: Association results.
          Containing the following list of Tensors:
  
              - track_targets (list[Tensor]): The mapping instance ids from
                  all positive proposals in the key image to all proposals
                  in the reference image, each tensor in list has
                  shape (len(key_pos_bboxes), len(ref_bboxes)).
              - track_weights (list[Tensor]): Loss weights for all positive
                  proposals in a batch, each tensor in list has
                  shape (len(key_pos_bboxes),).
      """
  
      track_targets = []
      track_weights = []
      for _gt_match_indices, key_res, ref_res in zip(
          gt_match_indices, key_sampling_results, ref_sampling_results
      ):
          targets = _gt_match_indices.new_zeros(
              (key_res.pos_bboxes.size(0), ref_res.bboxes.size(0)),
              dtype=torch.int,
          )
          _match_indices = _gt_match_indices[
              key_res.pos_assigned_gt_inds
          ]
          pos2pos = (
              _match_indices.view(-1, 1)
              == ref_res.pos_assigned_gt_inds.view(1, -1)
          ).int()
          targets[:, : pos2pos.size(1)] = pos2pos
          weights = (targets.sum(dim=1) > 0).float()
          track_targets.append(targets)
          track_weights.append(weights)
      return track_targets, track_weights
  
file_path: mmdetection/mmdet/models/tracking_heads/quasi_dense_embed_head.py
imports: from typing import List, Optional, Tuple
  import torch
  import torch.nn
  from mmcv.cnn import ConvModule
  from mmengine.model import BaseModule
  from torch import Tensor
  from torch.nn.modules.utils import _pair
  from mmdet.models.task_modules import SamplingResult
  from mmdet.registry import MODELS
  from ..task_modules.tracking import embed_similarity
label_desc: Use image node_id 4 for calling the QuasiDenseEmbedHead obj's underlying member method code with example usage: obj.get_targets(gt_match_indices, key_sampling_results, ref_sampling_results) and returns: track_targets,  track_weights