src/transformers/models/deformable_detr/modeling_deformable_detr.py/DeformableDetrLoss/_get_source_permutation_idx
class DeformableDetrLoss:    def _get_source_permutation_idx(self, indices):
        # permute predictions following indices
        batch_idx = torch.cat([torch.full_like(source, i) for i, (source, _) in enumerate(indices)])
        source_idx = torch.cat([source for (source, _) in indices])
        return batch_idx, source_idx