src/transformers/models/mask2former/modeling_mask2former.py/Mask2FormerLoss/_get_predictions_permutation_indices
class Mask2FormerLoss:    def _get_predictions_permutation_indices(self, indices):
        # Permute predictions following indices
        batch_indices = torch.cat([torch.full_like(src, i) for i, (src, _) in enumerate(indices)])
        predictions_indices = torch.cat([src for (src, _) in indices])
        return batch_indices, predictions_indices