mindspore.ops.coo_isinf
- mindspore.ops.coo_isinf(x)[源代码]
- 确定输入COOTensor每个位置上的元素是否为正负无穷大。 \[\begin{split}out_i = \begin{cases} & \text{ if } x_{i} = \text{Inf},\ \ True \\ & \text{ if } x_{i} \ne \text{Inf},\ \ False \end{cases}\end{split}\]- 其中 \(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]