mindspore.numpy.nanmin

View Source On Gitee
mindspore.numpy.nanmin(a, axis=None, dtype=None, keepdims=False)[source]

Returns the minimum of array elements over a given axis, ignoring any NaNs.

Note

Numpy arguments out is not supported. For all-NaN slices, a very large number is returned instead of NaN. On Ascend, since checking for NaN is currently not supported, it is not recommended to use np.nanmin. If the array does not contain NaN, np.min should be used instead.

Parameters
  • a (Union[int, float, list, tuple, Tensor]) – Array containing numbers whose minimum is desired. If a is not an array, a conversion is attempted.

  • axis (Union[int, tuple of int, None], optional) – Axis or axes along which the minimum is computed. The default is to compute the minimum of the flattened array.

  • dtype (mindspore.dtype, optional) – Default: None . Overrides the dtype of the output Tensor.

  • keepdims (boolean, optional) – Default: False . If this is set to True, the axes which are reduced are left in the result as dimensions with size one. With this option, the result will broadcast correctly against the original a.

Returns

Tensor.

Raises

ValueError – If axes are out of the range of [-a.ndim, a.ndim), or if the axes contain duplicates.

Supported Platforms:

GPU CPU

Examples

>>> import mindspore.numpy as np
>>> a = np.array([[1, 2], [3, np.nan]])
>>> output = np.nanmin(a)
>>> print(output)
1.0
>>> output = np.nanmin(a, axis=0)
>>> print(output)
[1. 2.]