Returns the k largest elements of the given input tensor along
a given dimension.
If dim is not given, the last dimension of the input is chosen.
If largest is FALSE then the k smallest elements are returned.
A namedtuple of (values, indices) is returned, where the indices are the indices
of the elements in the original input tensor.
The boolean option sorted if TRUE, will make sure that the returned
k elements are themselves sorted