<br />

|---|
| [![](https://www.tensorflow.org/images/GitHub-Mark-32px.png) View source on GitHub](https://github.com/keras-team/keras/tree/v3.15.1/keras/src/ops/numpy.py#L7656-L7670) |

Sorts the elements of `x` along a given axis in ascending order.

#### View aliases


**Main aliases**

[`tf.keras.ops.numpy.sort`](https://www.tensorflow.org/api_docs/python/tf/keras/ops/sort)

<br />

    tf.keras.ops.sort(
        x, axis=-1
    )

<br />

<br />

<br />

| ## Args ||
|---|---|
| `x` | Input tensor. |
| `axis` | Axis along which to sort. If `None`, the tensor is flattened before sorting. Defaults to `-1`; the last axis. |

<br />

<br />

<br />

<br />

| ## Returns ||
|---|---|
| Sorted tensor. ||

<br />