class_docstr: This part is partially derivated from:
  
  https://github.com/facebookresearch/detr/blob/main/models/detr.py.
class_docstr_tok: ["This","part","is","partially","derivated","from",":","https",":","\/\/github.com\/facebookresearch\/detr\/blob\/main\/models\/detr.py","."]
code: def _get_tgt_permutation_idx(self, indices):
      # permute targets following indices
      batch_idx = torch.cat(
          [
              torch.full_like(tgt, i)
              for i, (_, tgt) in enumerate(indices)
          ]
      )
      tgt_idx = torch.cat([tgt for (_, tgt) in indices])
      return batch_idx, tgt_idx
  
imports: import torch
  import torch.nn
  import torch.nn.functional
  from scipy.optimize import linear_sum_assignment
  from torch.cuda.amp import autocast
  from mmdet.registry import MODELS, TASK_UTILS
  from mmdet.utils import reduce_mean
label_desc: Use image node_id 3 for calling the SparseInstCriterion obj's underlying member method code with example usage: obj._get_tgt_permutation_idx(indices) and returns: batch_idx,  tgt_idx