mindspore.ops.argmin
- mindspore.ops.argmin(input, axis=None, keepdims=False)[source]
Returns the indices of the minimum value of a tensor across the axis.
If the shape of input tensor is \((x_1, ..., x_N)\), the shape of the output tensor is \((x_1, ..., x_{axis-1}, x_{axis+1}, ..., x_N)\).
- Parameters
- Returns
Tensor, indices of the min value of input tensor across the axis.
- Raises
TypeError – If axis is not an int.
- Supported Platforms:
Ascend
GPU
CPU
Examples
>>> import mindspore >>> import numpy as np >>> from mindspore import Tensor, ops >>> input_x = Tensor(np.array([2.0, 3.1, 1.2]), mindspore.float32) >>> index = ops.argmin(input_x) >>> print(index) 2