mindspore.ops.coo_isinf

查看源文件
mindspore.ops.coo_isinf(x: COOTensor)[源代码]

确定输入COOTensor每个位置上的元素是否为正负无穷大。

outi={ if xi=Inf,  True if xiInf,  False

其中 Inf 表示正负无穷大。

参数:
  • x (COOTensor) - 任意维度的COOTensor。

返回:

COOTensor,shape与输入相同,数据类型为bool。

异常:
  • TypeError - 如果 x 不是COOTensor。

支持平台:

GPU CPU

样例:

>>> from mindspore import dtype as mstype
>>> from mindspore import Tensor, ops, COOTensor
>>> indices = Tensor([[0, 1], [1, 2]], dtype=mstype.int64)
>>> values = Tensor([-1, 2], dtype=mstype.float32)
>>> shape = (3, 4)
>>> x = COOTensor(indices, values, shape)
>>> output = ops.coo_isinf(x)
>>> print(output.values)
[False False]