mindspore.ops.FloatStatus

class mindspore.ops.FloatStatus[source]

Determines if the elements contain Not a Number(NaN), infinite or negative infinite. 0 for normal, 1 for overflow.

Inputs:
  • x (Tensor) - The input tensor. The data type must be float16 or float32. \((N,*)\) where \(*\) means, any number of additional dimensions.

Outputs:

Tensor, has the shape of (1,), and the dtype is mindspore.dtype.float32.

Raises

TypeError – If dtype of x is neither float16 nor float32.

Supported Platforms:

GPU

Examples

>>> float_status = ops.FloatStatus()
>>> x = Tensor(np.array([np.log(-1), 1, np.log(0)]), mindspore.float32)
>>> result = float_status(x)
>>> print(result)
[1.]