Sorting¶
The API below provides methods for sorting tensor data
Cached API¶
-
template<typename OutputTensor, typename InputTensor>
void matx::sort(OutputTensor &a_out, const InputTensor &a, const SortDirection_t dir = SORT_DIR_ASC, const cudaStream_t stream = 0)¶ Sort rows of a tensor
Sort rows of a tensor using a radix sort. Currently supported types are float, double, ints, and long ints (both signed and unsigned). For a 1D tensor, a linear sort is performed. For 2D and above each row of the inner dimensions are batched and sorted separately. There is currently a restriction that the tensor must have contiguous data in both rows and columns, but this restriction may be removed in the future.
Note
Temporary memory is used during the sorting process, and about 2N will be allocated, where N is the length of the tensor.
- Template Parameters
T1 – Type of data to sort
RANK – Rank of tensor
- Parameters
a_out – Sorted tensor
a – Input tensor
dir – Direction to sort (either SORT_DIR_ASC or SORT_DIR_DESC)
stream – CUDA stream