y,i=lab.sort(x) returns a tensor y of the sorted columns of x, and a tensor i of the corresponding indices from x.

y,i=lab.sort(x,2) performs the sort operation for each row and y,i=lab.sort(x,n) performs the sort operation over the dimension n.