# sort¶

`paddle.` `sort` ( x, axis=- 1, descending=False, name=None ) [source]

This OP sorts the input along the given axis, and returns the sorted output tensor. The default sort algorithm is ascending, if you want the sort algorithm to be descending, you must set the `descending` as True.

Parameters
• x (Tensor) – An input N-D Tensor with type float32, float64, int16, int32, int64, uint8.

• axis (int, optional) – Axis to compute indices along. The effective range is [-R, R), where R is Rank(x). when axis<0, it works the same way as axis+R. Default is 0.

• descending (bool, optional) – Descending is a flag, if set to true, algorithm will sort by descending order, else sort by ascending order. Default is false.

• name (str, optional) – The default value is None. Normally there is no need for user to set this property. For more information, please refer to Name.

Returns

sorted tensor(with the same shape and data type as `x`).

Return type

Tensor

Examples

```import paddle

[0,0,1,7],
[6,9,2,4]],
[[5,2,4,2],
[4,7,7,9],
[1,7,0,6]]],
dtype='float32')
print(out1)
#[[[5. 5. 8. 9.]
#  [0. 0. 1. 7.]
#  [2. 4. 6. 9.]]
# [[2. 2. 4. 5.]
#  [4. 7. 7. 9.]
#  [0. 1. 6. 7.]]]
print(out2)
#[[[5. 2. 4. 2.]
#  [0. 0. 1. 7.]
#  [1. 7. 0. 4.]]
# [[5. 8. 9. 5.]
#  [4. 7. 7. 9.]
#  [6. 9. 2. 6.]]]
print(out3)
#[[[0. 0. 1. 4.]
#  [5. 8. 2. 5.]
#  [6. 9. 9. 7.]]
# [[1. 2. 0. 2.]
#  [4. 7. 4. 6.]
#  [5. 7. 7. 9.]]]
```