I have a 2D tensor and I would like to sort by the first dimension like this example:
a = torch.FloatTensor(
[[5, 5],
[5, 3],
[3, 5],
[6, 4],
[3, 7]])
And I expected this result after sorting:
a = torch.FloatTensor(
[[3, 5],
[3, 7],
[5, 3],
[5, 5],
[6, 4]])
Is it possible to do this in pytorch? I know that is possible to do it in numpy, but I want do it in GPU using torch.
values, _ = a.sort(0)
– umbreon29