mindspore.ops.Reciprocal

class mindspore.ops.Reciprocal(*args, **kwargs)[source]

Returns reciprocal of a tensor element-wise.

Inputs:
  • x (Tensor) - The input tensor.

Outputs:

Tensor, has the same shape as the x.

Raises

TypeError – If x is not a Tensor.

Supported Platforms:

Ascend GPU CPU

Examples

>>> x = Tensor(np.array([1.0, 2.0, 4.0]), mindspore.float32)
>>> reciprocal = ops.Reciprocal()
>>> output = reciprocal(x)
>>> print(output)
[1.   0.5  0.25]