I there anyway to just get the sorted value without indices?

When I sort a huge matrix, using torch.sort(), I encountered cuda out of memory error.

In my case, I only need the sorted value, i.e. torch.sort(tensor)[0]. While torch.sort returns two tensors, which might be memory consuming for me.

I am wondering if there is other functions or options to use to get rid of that. Thanks!

2 Likes