mindspore.mint.amin
- mindspore.mint.amin(input, dim=(), keepdim=False)[source]
Compute the minimum value of all elements along the specified dimension.
Warning
This is an experimental API that is subject to change or deletion.
- Parameters
- Returns
Tensor
- Supported Platforms:
Ascend
Examples
>>> import mindspore >>> import numpy as np >>> x = mindspore.tensor(np.random.randn(3, 4, 5, 6).astype(np.float32)) >>> output = mindspore.mint.amin(x, 1, keepdim=True) >>> result = output.shape >>> print(result) (3, 1, 5, 6) >>> # case 1: Reduce a dimension by the minimum value of all elements in the dimension. >>> x = mindspore.tensor(np.array([[[1, 1, 1, 1, 1, 1], [2, 2, 2, 2, 2, 2], [3, 3, 3, 3, 3, 3]], ... [[4, 4, 4, 4, 4, 4], [5, 5, 5, 5, 5, 5], [6, 6, 6, 6, 6, 6]], ... [[7, 7, 7, 7, 7, 7], [8, 8, 8, 8, 8, 8], [9, 9, 9, 9, 9, 9]]]), ... mindspore.float32) >>> output = mindspore.mint.amin(x) >>> print(output) 1.0 >>> print(output.shape) () >>> # case 2: Reduce a dimension along axis 0. >>> output = mindspore.mint.amin(x, 0, True) >>> print(output) [[[1. 1. 1. 1. 1. 1.] [2. 2. 2. 2. 2. 2.] [3. 3. 3. 3. 3. 3.]]] >>> # case 3: Reduce a dimension along axis 1. >>> output = mindspore.mint.amin(x, 1, True) >>> print(output) [[[1. 1. 1. 1. 1. 1.]] [[4. 4. 4. 4. 4. 4.]] [[7. 7. 7. 7. 7. 7.]]] >>> # case 4: Reduce a dimension along axis 2. >>> output = mindspore.mint.amin(x, 2, True) >>> print(output) [[[1.] [2.] [3.]] [[4.] [5.] [6.]] [[7.] [8.] [9.]]]