mindspore.Tensor.isneginf
- mindspore.Tensor.isneginf()
逐元素判断是否是负inf。
警告
这是一个实验性API,后续可能修改或删除。
对于Ascend,仅支持 Atlas A2 训练系列产品。
- 返回:
Tensor,shape与输入shape相同,对应 self 元素为负inf的位置是
true
,反之为false
。- 支持平台:
Ascend
GPU
CPU
样例:
>>> from mindspore import Tensor >>> from mindspore import dtype as mstype >>> x = Tensor([[-float("inf"), float("inf")], [1, -float("inf")]], mstype.float32) >>> output = x.isneginf() >>> print(output) [[ True False] [False True]]