I'm new to Pytorch. Given a tensor set, I need to sort these tensors by the key value. For example,
A =
[[0.9133, 0.5071, 0.6222, 3.],
[0.5951, 0.9315, 0.6548, 1.],
[0.7704, 0.0720, 0.0330, 2.]]
My expected result after sorting is:
A' =
[[0.5951, 0.9315, 0.6548, 1.],
[0.7704, 0.0720, 0.0330, 2.],
[0.9133, 0.5071, 0.6222, 3.]]
I tried to use sorted function in python, but it was time-consuming in my training process. How to achieve it more efficiently? Thanks!