mindspore.mint.min
- mindspore.mint.min(input) Tensor [source]
Returns the minimum value of the input tensor.
- Parameters
input (Tensor) – The input tensor.
- Returns
Scalar Tensor with the same dtype as input, the minimum value of the input.
- Supported Platforms:
Ascend
Examples
>>> import mindspore >>> import numpy as np >>> from mindspore import Tensor, mint >>> x = Tensor(np.array([0.0, 0.4, 0.6, 0.7, 0.1]), mindspore.float32) >>> output = mint.min(x) >>> print(output) 0.0
Calculates the minimum value along with the given dim for the input tensor, and returns the minimum values and indices.
- Parameters
input (Tensor) – \((input_1, input_2, ..., input_N)\) , Complex tensor is not supported.
dim (int) – The dimension to reduce.
keepdim (bool, optional) – Whether to reduce dimension, if
True
the output will keep the same dimension as the input, the output will reduce dimension iffalse
. Default:False
.
- Returns
tuple (Tensor), tuple of 2 tensors, containing the minimum value of the self tensor along the given dimension dim and the corresponding index.
values (Tensor) - The minimum value of input tensor, with the same shape as index, and same dtype as input.
index (Tensor) - The index for the minimum value of the input tensor, with dtype int64. If keepdim is
True
, the shape of output tensors is \((input_1, input_2, ..., input_{dim-1}, 1, input_{dim+1}, ..., input_N)\). Otherwise, the shape is \((input_1, input_2, ..., input_{dim-1}, input_{dim+1}, ..., input_N)\) .
- Raises
- Supported Platforms:
Ascend
Examples
>>> import mindspore >>> import numpy as np >>> from mindspore import Tensor, mint >>> x = Tensor(np.array([0.0, 0.4, 0.6, 0.7, 0.1]), mindspore.float32) >>> output, index = mint.min(x, 0, keepdim=True) >>> print(output, index) [0.0] [0]
For details, please refer to
mindspore.mint.minimum()
.