Right, unfortunately we don’t have stable sort implemented.
There are already some discussion on adding stable sorts (for topk for example: https://github.com/pytorch/pytorch/issues/27542 65).
If this is really a blocker for you, you can open a new issue to add a stable sort explaining your use case.