mindspore.Tensor.reciprocal

Tensor.reciprocal() Tensor

Returns reciprocal of a tensor element-wise.

\[out_{i} = \frac{1}{self_{i}}\]
Returns

Tensor, has the same shape as the self.

Supported Platforms:

Ascend GPU CPU

Examples

>>> import mindspore
>>> import numpy as np
>>> from mindspore import Tensor
>>> input = Tensor(np.array([1.0, 2.0, 4.0]), mindspore.float32)
>>> output = input.reciprocal()
>>> print(output)
[1.   0.5  0.25]