mindspore.ops.Argmin
- class mindspore.ops.Argmin(axis=- 1, output_type=mstype.int32)[source]
Returns the indices of the minimum value along a specified axis of a Tensor.
If the shape of input tensor is
, the shape of the output tensor is .- Parameters
axis (int, optional) – Axis where the Argmin operation applies to. Default:
-1
.output_type (
mindspore.dtype
, optional) – Output data type. Supported types:mstype.int32
,mstype.int64
. Default:mstype.int32
.
- Inputs:
input_x (Tensor) - Input tensor. The shape is
where means, any number of additional dimensions.
- Outputs:
Tensor, which is the minimum index in the specified axis of input Tensor.
- 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