mindspore.numpy.argmax
- mindspore.numpy.argmax(a, axis=None)[源代码]
Returns the indices of the maximum values along an axis.
说明
Numpy argument out is not supported. On Ascend, in case of multiple occurrences of the maximum values, the return indices may not necessarily correspond to the first occurrence.
- 参数
- 返回
Tensor, array of indices into the array. It has the same shape as a.shape with the dimension along axis removed.
- 异常
ValueError – If axis is out of range.
- Supported Platforms:
Ascend
GPU
CPU
样例
>>> import mindspore.numpy as np >>> a = np.arange(10, 16).reshape(2, 3) >>> print(np.argmax(a)) 5 >>> print(np.argmax(a, axis=0)) [1 1 1] >>> print(np.argmax(a, axis=1)) [2 2]