<br />

|---|
| [![](https://www.tensorflow.org/images/GitHub-Mark-32px.png) View source on GitHub](https://github.com/tensorflow/tensorflow/blob/v2.21.0/tensorflow/python/ops/math_ops.py#L5849-L5871) |

Computes reciprocal of square root of x element-wise.

#### View aliases


**Compat aliases for migration**

See
[Migration guide](https://www.tensorflow.org/guide/migrate) for
more details.

[`tf.compat.v1.rsqrt`](https://www.tensorflow.org/api_docs/python/tf/math/rsqrt)

<br />

    tf.math.rsqrt(
        x, name=None
    )

### Used in the notebooks

| Used in the tutorials |
|---|
| - [Neural machine translation with a Transformer and Keras](https://www.tensorflow.org/text/tutorials/transformer) |

#### For example:

    x = tf.constant([2., 0., -2.])
    tf.math.rsqrt(x)
    <tf.Tensor: shape=(3,), dtype=float32,
    numpy=array([0.707, inf, nan], dtype=float32)>

<br />

<br />

<br />

| ## Args ||
|---|---|
| `x` | A [`tf.Tensor`](https://www.tensorflow.org/api_docs/python/tf/Tensor). Must be one of the following types: `bfloat16`, `half`, `float32`, `float64`. |
| `name` | A name for the operation (optional). |

<br />

<br />

<br />

<br />

| ## Returns ||
|---|---|
| A [`tf.Tensor`](https://www.tensorflow.org/api_docs/python/tf/Tensor). Has the same type as `x`. ||

<br />