mindspore.Tensor.argmin

Tensor.argmin(axis=None)[source]

Return the indices of the minimum values along an axis.

Parameters

axis (int, optional) – By default, the index is into the flattened tensor, otherwise along the specified axis. Default: None.

Returns

Tensor, indices into the input tensor. It has the same shape as self.shape with the dimension along axis removed.

Raises

ValueError – If the axis is out of range.

Supported Platforms:

Ascend GPU CPU

See also

mindspore.Tensor.argmax(): Return the indices of the maximum values along an axis.

mindspore.Tensor.min(): Return the minimum of a tensor or minimum along an axis.

mindspore.Tensor.max(): Return the maximum of a tensor or maximum along an axis.

Examples

>>> import numpy as np
>>> from mindspore import Tensor
>>> a = Tensor(np.arange(10, 16).reshape(2, 3).astype("float32"))
>>> print(a.argmin())
0