Hi! torch.unique has return_inverse argument. When set to True it will return an index to re-construct the original tensor from the sorted one.
sorted_and_unique, idx = torch.unique(orig_input, 0, return_inverse=True)
# recontruct the original (same as orig_input)
original = sorted_and_unique[idx]

Would there be a way to get the reverse mapping rev_idx such that orig_input[rev_idx] would result in sorted_and_unique?
The use case is that I have two tensors coords (N by 3 tensor) and features (N by 125 tensor). I would like to remove duplicates and sort coords using torch.unique as above and then use rev_idx to select the same rows in same order from feats. In other words, torch.unique offers mapping from sorted tensor to original tensor, I would like to get a mapping from original tensor to sorted tensor.