dpctl.tensor.sort

dpctl.tensor.sort(x, axis=-1, descending=False, stable=True)[source]

Returns a sorted copy of an input array x.

Parameters:
  • x (usm_ndarray) – input array.

  • axis (Optional[int]) – axis along which to sort. If set to -1, the function must sort along the last axis. Default: -1.

  • descending (Optional[bool]) – sort order. If True, the array must be sorted in descending order (by value). If False, the array must be sorted in ascending order (by value). Default: False.

  • stable (Optional[bool]) – sort stability. If True, the returned array must maintain the relative order of x values which compare as equal. If False, the returned array may or may not maintain the relative order of x values which compare as equal. Default: True.

  • kind (Optional[Literal["stable", "mergesort", "radixsort"]]) – Sorting algorithm. The default is “stable”, which uses parallel merge-sort or parallel radix-sort algorithms depending on the array data type.

Returns:

a sorted array. The returned array has the same data type and the same shape as the input array x.

Return type:

usm_ndarray