Sorts the elements of the input tensor along a given dimension
in ascending order by value.
If dim is not given, the last dimension of the input is chosen.
If descending is TRUE then the elements are sorted in descending
order by value.
A namedtuple of (values, indices) is returned, where the values are the
sorted values and indices are the indices of the elements in the original
input tensor.