triton.language.sort

triton.language.sort(x, dim: constexpr | None = None, descending: constexpr = constexpr[0])

Sorts a tensor along a specified dimension.

Parameters:
  • x (Tensor) – The input tensor to be sorted.

  • dim (int, optional) – The dimension along which to sort the tensor. If None, the tensor is sorted along the last dimension. Currently, only sorting along the last dimension is supported.

  • descending (bool, optional) – If set to True, the tensor is sorted in descending order. If set to False, the tensor is sorted in ascending order.

This function can also be called as a member function on tensor, as x.sort(...) instead of sort(x, ...).