mindspore.ops.coo_inv
- mindspore.ops.coo_inv(x: COOTensor)[source]
Computes Reciprocal of input COOTensor element-wise.
\[out_i = \frac{1}{x_{i} }\]- Parameters
x (COOTensor) – Input COOTensor. Must be one of the following types: float16, float32 or int32.
- Returns
COOTensor, has the same type and shape as input shape value.
- Raises
- Supported Platforms:
Ascend
GPU
CPU
Examples
>>> 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_inv(x) >>> print(output.values) [-1. 0.5]