diff --git a/mindspore/python/mindspore/_extends/parse/standard_method.py b/mindspore/python/mindspore/_extends/parse/standard_method.py index b5f3b2807bd..e6dae9beb02 100644 --- a/mindspore/python/mindspore/_extends/parse/standard_method.py +++ b/mindspore/python/mindspore/_extends/parse/standard_method.py @@ -540,7 +540,7 @@ def argmax(x, axis=None): return P.Argmax(axis)(x) -def arg_min_with_value(x, axis=0, keep_dims=False): +def argmin_with_value(x, axis=0, keep_dims=False): """ Calculates the minimum value with corresponding index, and returns indices and values. diff --git a/mindspore/python/mindspore/common/tensor.py b/mindspore/python/mindspore/common/tensor.py index f59ea6e947f..15c7636028d 100644 --- a/mindspore/python/mindspore/common/tensor.py +++ b/mindspore/python/mindspore/common/tensor.py @@ -2176,7 +2176,7 @@ class Tensor(Tensor_): # P.Argmin is currently not supported return tensor_operator_registry.get('argmax')(axis)(tensor_operator_registry.get('__neg__')(a)) - def arg_min_with_value(self, axis=0, keep_dims=False): + def argmin_with_value(self, axis=0, keep_dims=False): """ Returns the minimum value with corresponding index. @@ -2211,15 +2211,15 @@ class Tensor(Tensor_): Examples: >>> x = Tensor(np.array([0.0, 0.4, 0.6, 0.7, 0.1]), mindspore.float32) - >>> output = x.arg_min_with_value() + >>> output = x.argmin_with_value() >>> print(output) 0 0.0 - >>> output = x.arg_min_with_value(keep_dims=True) + >>> output = x.argmin_with_value(keep_dims=True) >>> print(output) [0] [0.0] """ self._init_check() - return tensor_operator_registry.get('arg_min_with_value')(self, axis, keep_dims) + return tensor_operator_registry.get('argmin_with_value')(self, axis, keep_dims) def cumsum(self, axis=None, dtype=None): """ diff --git a/mindspore/python/mindspore/ops/functional.py b/mindspore/python/mindspore/ops/functional.py index 91be0a433e9..61e58c1db28 100644 --- a/mindspore/python/mindspore/ops/functional.py +++ b/mindspore/python/mindspore/ops/functional.py @@ -889,7 +889,7 @@ tensor_operator_registry.register('norm', norm) tensor_operator_registry.register('renorm', renorm) tensor_operator_registry.register('adaptive_max_pool2d', AdaptiveMaxPool2D) tensor_operator_registry.register('coalesce', coalesce) -tensor_operator_registry.register('arg_min_with_value', min) +tensor_operator_registry.register('argmin_with_value', min) tensor_operator_registry.register('coo_add', sparse_add) tensor_operator_registry.register('top_k', P.TopK) __all__ = [name for name in dir() if name[0] != "_"] diff --git a/mindspore/python/mindspore/ops/operations/array_ops.py b/mindspore/python/mindspore/ops/operations/array_ops.py index 462144e4e26..53fa96784ce 100755 --- a/mindspore/python/mindspore/ops/operations/array_ops.py +++ b/mindspore/python/mindspore/ops/operations/array_ops.py @@ -2161,7 +2161,7 @@ class ArgMinWithValue(Primitive): - If there are multiple minimum values, the index of the first minimum value is used. - The value range of "axis" is [-dims, dims - 1]. "dims" is the dimension length of "x". - Also see: func: `mindspore.ops.arg_min_with_value`. + Also see: func: `mindspore.ops.min`. Args: axis (int): The dimension to reduce. Default: 0. diff --git a/tests/st/ops/gpu/test_argminwithvalue_op.py b/tests/st/ops/gpu/test_argminwithvalue_op.py index 9096dca87c0..92a8965db32 100644 --- a/tests/st/ops/gpu/test_argminwithvalue_op.py +++ b/tests/st/ops/gpu/test_argminwithvalue_op.py @@ -109,7 +109,7 @@ def argminwithvalue_tensor(context_mode, np_type): [67., 8., 9.], [130., 24., 15.], [0.3, -0.4, -15.]]).astype(np_type)) - return x.arg_min_with_value(axis=-1) + return x.argmin_with_value(axis=-1) @pytest.mark.level1 @@ -184,7 +184,7 @@ def test_argminwithvalue_functional(): @pytest.mark.env_onecard def test_argminwithvalue_tensor(): """ - Feature: support tensor's arg_min_with_value op. + Feature: support tensor's argmin_with_value op. Description: test the op using tensor. Expectation: expect correct result. """ @@ -210,7 +210,7 @@ def test_argminwithvalue_tensor(): @pytest.mark.env_onecard def test_argminwithvalue_dynamic_shape(): """ - Feature: support arg_min_with_value op with dynamic shape. + Feature: support argmin_with_value op with dynamic shape. Description: test the op with dynamic shape Expectation: expect correct result. """