mindspore.Tensor.inv
- Tensor.inv()[source]
Computes Reciprocal of this Tensor element-wise.
\[out_i = \frac{1}{x_{i} }\]where x refers to self Tensor.
- Returns
Tensor, has the same type and shape as self Tensor.
- Raises
TypeError – If dtype of this Tensor is not one of float16, float32, int32.
- Supported Platforms:
Ascend
GPU
CPU
Examples
>>> x = Tensor(np.array([0.25, 0.4, 0.31, 0.52]), mindspore.float32) >>> output = x.inv() >>> print(output) [4. 2.5 3.2258065 1.923077 ]