src/transformers/models/maskformer/modeling_maskformer.py/MaskFormerLoss/_get_targets_permutation_indices
class MaskFormerLoss:    def _get_targets_permutation_indices(self, indices):
        # permute labels following indices
        batch_indices = torch.cat([torch.full_like(tgt, i) for i, (_, tgt) in enumerate(indices)])
        target_indices = torch.cat([tgt for (_, tgt) in indices])
        return batch_indices, target_indices