mindspore.ops.coo_cos
- mindspore.ops.coo_cos(x)[源代码]
- 逐元素计算COOTensor输入的余弦。 \[out_i = \cos(x_i)\]- 警告 - 目前支持float16、float32数据类型。如果使用float64,可能会存在精度丢失的问题。 - 参数:
- x (COOTensor) - COOTensor的输入。 
 
- 返回:
- COOTensor,shape与 x 相同。 
- 异常:
- TypeError - x 不是COOTensor。 
- TypeError - x 的数据类型不是float16、float32、float64、complex64或complex128。 
 
- 支持平台:
- Ascend- 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_cos(x) >>> print(output.values) [ 0.5403023 -0.41614684]