mindspore.ops.isnan

mindspore.ops.isnan(x)[源代码]

判断输入数据每个位置上的值是否是Nan。

outi={ True,  if xi=Nan False,  if xiNan

其中 Nan 表示的不是number。

参数:
  • x (Tensor) - IsNan的输入。

返回:

Tensor,输出的shape与输入相同,数据类型为bool。

异常:
  • TypeError - x 不是Tensor。

支持平台:

Ascend GPU CPU

样例:

>>> x = Tensor(np.array([np.log(-1), 1, np.log(0)]), mindspore.float32)
>>> output = ops.isnan(x)
>>> print(output)
[ True False False]