In the documentation torch.topk uses four parameter such as topk(self, k, dim=None, largest=True, sorted=True). In case of sorted=False, it gives ascending order sorted elements. This is quite confusing. If sorted=False it should provide first come first serve elements. Essentially index should be sorted.
@Soumith_Chintala