If I perform torch.sort(a), then the index it returns will be
[0, 1, 2, 3]
What if I want to get the result like
[0, 1, 1, 3]
I know there’s a function exists in scipy “scipy.data.rankdata”, in the function, I can specify the method it uses when ranking the data. But how can I achieve the similar goal with pytorch?
I dont think there’s a direct way to do [0, 1, 1, 3]. Unique gives you what you want from an ordering perspective, but does not account for the right magnitude,