Indices into the sorted_tensor such that ``sorted_tensor[restoration_indices] == original_tensor``
sorted_sequence_lengths, permutation_index = sequence_lengths.sort(0, descending=True)
sorted_tensor = tensor[permutation_index]
// This is the equivalent of zipping with index, sorting by the original
// sequence lengths and returning the now sorted indices.
index_range = torch.range(0, len(sequence_lengths) - 1).long()
_, reverse_mapping = permutation_index.sort(0, descending=False)