!39170 Update argmin with value tensor api name

Merge pull request !39170 from ZPaC/update-argmin-with-value-name
This commit is contained in:
i-robot 2022-07-30 02:06:51 +00:00 committed by Gitee
commit dd5391af5d
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
5 changed files with 10 additions and 10 deletions

View File

@ -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.

View File

@ -2180,7 +2180,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.
@ -2215,15 +2215,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):
"""

View File

@ -890,7 +890,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] != "_"]

View File

@ -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.

View File

@ -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.
"""