mindspore.numpy.isinf
- mindspore.numpy.isinf(x, dtype=None)[源代码]
Tests element-wise for positive or negative infinity.
Returns a boolean array of the same shape as x, True where
x == +/-inf
, otherwise False.说明
Numpy arguments out, where, casting, order, subok, signature, and extobj are not supported. Only np.float32 is currently supported.
- 参数
x (Tensor) – Input values.
dtype (
mindspore.dtype
, optional) – Defaults to None. Overrides the dtype of the output Tensor.
- 返回
Tensor or scalar, true where x is positive or negative infinity, false otherwise. This is a scalar if x is a scalar.
- Supported Platforms:
GPU
CPU
样例
>>> import mindspore.numpy as np >>> output = np.isinf(np.array(np.inf, np.float32)) >>> print(output) True >>> output = np.isinf(np.array([np.inf, -np.inf, 1.0, np.nan], np.float32)) >>> print(output) [ True True False False]