mindspore.ops.msort

View Source On Gitee
mindspore.ops.msort(input)[source]

Return a tensor obtained by sorting the input tensor in ascending order along its first dimension.

ops.msort(input) is equivalent to ops.sort(axis=0)(input)[0]. See also mindspore.ops.Sort() for more details.

Parameters

input (Tensor) – The input tensor to sort.

Returns

Tensor

Supported Platforms:

Ascend GPU CPU

Examples

>>> import mindspore
>>> input = mindspore.tensor([[8, 2, 1],
...                           [5, 9, 3],
...                           [4, 6, 7]])
>>> mindspore.ops.msort(input)
Tensor(shape=[3, 3], dtype=Int64, value=
[[4, 2, 1],
 [5, 6, 3],
 [8, 9, 7]])
>>> # is equivalent to `ops.sort(axis=0)(input)[0]`
>>> mindspore.ops.sort(input, axis=0)[0]
Tensor(shape=[3, 3], dtype=Int64, value=
[[4, 2, 1],
 [5, 6, 3],
 [8, 9, 7]])