mindspore.ops.Rsqrt
- class mindspore.ops.Rsqrt[source]
Computes reciprocal of square root of input tensor element-wise.
Refer to
mindspore.ops.rsqrt()
for more details.- Inputs:
x (Tensor) - The input Tensor, each element must be a non-negative, if an element is negative, the calculation result is nan.
- Outputs:
Tensor, has the same type and shape as x.
- Supported Platforms:
Ascend
GPU
CPU
Examples
>>> import mindspore >>> from mindspore import Tensor, ops >>> input_tensor = Tensor([[4, 4], [9, 9]], mindspore.float32) >>> rsqrt = ops.Rsqrt() >>> output = rsqrt(input_tensor) >>> print(output) [[0.5 0.5 ] [0.33333334 0.33333334]]