mindspore.ops.rsqrt

mindspore.ops.rsqrt(input)[source]

Computes reciprocal of square root of input tensor element-wise.

\[out_{i} = \frac{1}{\sqrt{input_{i}}}\]
Parameters

input (Tensor) – The input of rsqrt. Its each element must be a non-negative number, if an element is negative, the calculation result is nan.

Returns

Tensor, has the same shape and dtype as the input.

Raises

TypeError – If input is not a Tensor.

Supported Platforms:

Ascend GPU CPU

Examples

>>> import mindspore as ms
>>> import mindspore.ops as ops
>>> input = ms.Tensor([-0.0370,  0.2970,  1.5420, -0.9105])
>>> output = ops.rsqrt(input)
>>> print(output)
[       nan 1.8349396  0.80530024        nan]