mindspore.ops.isfinite

查看源文件
mindspore.ops.isfinite(input)[源代码]

逐元素返回输入tensor中元素是否是有限数。 有限数定义:非 NaN-INFINF 的元素。

参数:
  • input (Tensor) - 输入tensor。

返回:

Tensor

支持平台:

Ascend GPU CPU

样例:

>>> import mindspore
>>> input = mindspore.tensor([-1, 3, float("inf"), float("-inf"), float("nan")])
>>> mindspore.ops.isfinite(input)
Tensor(shape=[5], dtype=Bool, value= [ True,  True, False, False, False])