Torch.unique() without sorting on GPU

Is there some way that torch.unique() can return the unordered unique tensor on GPU?
e.g. when inputting [6,2,7,2,6,5] I expect [6,2,7,5] . Or some other torch functions that can do this?
I referred to this and this issue but didn’t get much help. The custom function given in the second link works but the efficiency is very low as I have a very long tensor.

1 Like