If you don’t specify sorted=True, there is no guarantee of any order (sorted or original order).



 ShengweiAn:

Such as the non-determinism incurred by the parallelism.
But rerunning topk for servel times gave same results.


Yes, that’s most likely the reason at least for GPU runs. I’m not sure, how this method is implemented on the CPU.