src/transformers/models/table_transformer/modeling_table_transformer.py/TableTransformerLoss/_get_target_permutation_idx
class TableTransformerLoss:    def _get_target_permutation_idx(self, indices):
        # permute targets following indices
        batch_idx = torch.cat([torch.full_like(target, i) for i, (_, target) in enumerate(indices)])
        target_idx = torch.cat([target for (_, target) in indices])
        return batch_idx, target_idx