|
56 | 56 | 'sqrt', 'cbrt', 'abs', 'absolute', 'exp', 'expm1', 'arcsin', 'arccos', 'arctan', 'sign', 'log',
|
57 | 57 | 'degrees', 'log2', 'log1p', 'rint', 'radians', 'reciprocal', 'square', 'negative', 'histogram',
|
58 | 58 | 'fix', 'ceil', 'floor', 'trunc', 'logical_not', 'arcsinh', 'arccosh', 'arctanh', 'append', 'argsort',
|
59 |
| - 'tensordot', 'eye', 'linspace', 'logspace', 'expand_dims', 'tile', 'arange', 'array_split', |
| 59 | + 'sort', 'tensordot', 'eye', 'linspace', 'logspace', 'expand_dims', 'tile', 'arange', 'array_split', |
60 | 60 | 'split', 'vsplit', 'concatenate', 'stack', 'vstack', 'row_stack', 'column_stack', 'hstack', 'dstack',
|
61 | 61 | 'average', 'mean', 'maximum', 'minimum', 'swapaxes', 'clip', 'argmax', 'argmin', 'std', 'var',
|
62 | 62 | 'indices', 'copysign', 'ravel', 'unravel_index', 'hanning', 'hamming', 'blackman', 'flip', 'flipud',
|
@@ -1531,13 +1531,13 @@ def pick(self, *args, **kwargs):
|
1531 | 1531 | """
|
1532 | 1532 | raise AttributeError('mxnet.numpy.ndarray object has no attribute pick')
|
1533 | 1533 |
|
1534 |
| - def sort(self, *args, **kwargs): |
| 1534 | + def sort(self, axis=-1, kind=None, order=None): # pylint: disable=arguments-differ |
1535 | 1535 | """Convenience fluent method for :py:func:`sort`.
|
1536 | 1536 |
|
1537 | 1537 | The arguments are the same as for :py:func:`sort`, with
|
1538 | 1538 | this array as data.
|
1539 | 1539 | """
|
1540 |
| - raise NotImplementedError |
| 1540 | + raise sort(self, axis=axis, kind=kind, order=order) |
1541 | 1541 |
|
1542 | 1542 | def topk(self, *args, **kwargs):
|
1543 | 1543 | """Convenience fluent method for :py:func:`topk`.
|
@@ -4644,6 +4644,48 @@ def argsort(a, axis=-1, kind=None, order=None):
|
4644 | 4644 | return _mx_nd_np.argsort(a, axis=axis, kind=kind, order=order)
|
4645 | 4645 |
|
4646 | 4646 |
|
| 4647 | +@set_module('mxnet.numpy') |
| 4648 | +def sort(a, axis=-1, kind=None, order=None): |
| 4649 | + """ |
| 4650 | + Return a sorted copy of an array. |
| 4651 | +
|
| 4652 | + Parameters |
| 4653 | + ---------- |
| 4654 | + a : ndarray |
| 4655 | + Array to be sorted. |
| 4656 | + axis : int or None, optional |
| 4657 | + Axis along which to sort. The default is -1 (the last axis). If None, |
| 4658 | + the flattened array is used. |
| 4659 | + kind : string, optional |
| 4660 | + This argument can take any string, but it does not have any effect on the |
| 4661 | + final result. |
| 4662 | + order : str or list of str, optional |
| 4663 | + Not supported yet, will raise NotImplementedError if not None. |
| 4664 | +
|
| 4665 | + Returns |
| 4666 | + ------- |
| 4667 | + sorted_array : ndarray |
| 4668 | + Array of the same type and shape as `a`. |
| 4669 | +
|
| 4670 | + Notes |
| 4671 | + ----- |
| 4672 | + This operator does not support different sorting algorithms. |
| 4673 | +
|
| 4674 | + Examples |
| 4675 | + -------- |
| 4676 | + >>> a = np.array([[1,4],[3,1]]) |
| 4677 | + >>> np.sort(a) # sort along the last axis |
| 4678 | + array([[1, 4], |
| 4679 | + [1, 3]]) |
| 4680 | + >>> np.sort(a, axis=None) # sort the flattened array |
| 4681 | + array([1, 1, 3, 4]) |
| 4682 | + >>> np.sort(a, axis=0) # sort along the first axis |
| 4683 | + array([[1, 1], |
| 4684 | + [3, 4]]) |
| 4685 | + """ |
| 4686 | + return _mx_nd_np.sort(a, axis=axis, kind=kind, order=order) |
| 4687 | + |
| 4688 | + |
4647 | 4689 | @set_module('mxnet.numpy')
|
4648 | 4690 | def tensordot(a, b, axes=2):
|
4649 | 4691 | r"""
|
|
0 commit comments