megengine.functional.sort#
- sort(inp, descending=False)[source]#
Returns sorted tensor and the indices would sort the input tensor.
- Parameters:
- Return type:
- Returns:
tuple of two tensors (sorted_tensor, indices_of_int32).
Examples
>>> import numpy as np >>> x = Tensor(np.array([1,2], dtype=np.float32)) >>> out, indices = F.sort(x) >>> out.numpy() array([1., 2.], dtype=float32)