mindspore.ops.Rsqrt
- class mindspore.ops.Rsqrt[source]
Computes reciprocal of square root of input tensor element-wise.
\[out_{i} = \frac{1}{\sqrt{x_{i}}}\]- Inputs:
x (Tensor) - The input of Rsqrt. Each element must be a non-negative number. \((N,*)\) where \(*\) means, any number of additional dimensions, its rank should less than 8.
- Outputs:
Tensor, has the same type and shape as x.
- Raises
TypeError – If dtype of x is neither float16 nor float32.
- Supported Platforms:
Ascend
GPU
Examples
>>> 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]]