mindspore.Tensor.isinf
- mindspore.Tensor.isinf()
确定 self 每个位置上的元素是否为正无穷或负无穷。
其中
表示无穷大。警告
该API目前只支持在Atlas A2训练系列产品上使用。
- 返回:
Tensor,shape与 self 相同,数据的类型为bool。
- 支持平台:
Ascend
CPU
GPU
样例:
>>> import mindspore >>> import numpy as np >>> from mindspore import Tensor >>> x = Tensor(np.array([np.log(-1), 1, np.log(0)]), mindspore.float32) >>> output = x.isinf() >>> print(output) [False False True] >>> x = Tensor(2.1, mindspore.float64) >>> output = x.isinf() >>> print(output) False