# tf.keras.backend.var

<br />

|---|---|
| [![](https://www.tensorflow.org/images/tf_logo_32px.png) TensorFlow 2 version](https://www.tensorflow.org/api_docs/python/tf/keras/backend/var) | [![](https://www.tensorflow.org/images/GitHub-Mark-32px.png) View source on GitHub](https://github.com/tensorflow/tensorflow/blob/v1.15.0/tensorflow/python/keras/backend.py#L1946-L1963) |

Variance of a tensor, alongside the specified axis.

#### View aliases


**Compat aliases for migration**

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

[`tf.compat.v1.keras.backend.var`](https://www.tensorflow.org/api_docs/python/tf/keras/backend/var), \`tf.compat.v2.keras.backend.var\`

<br />

    tf.keras.backend.var(
        x, axis=None, keepdims=False
    )

<br />

<br />

<br />

| ## Arguments ||
|---|---|
| `x` | A tensor or variable. |
| `axis` | An integer, the axis to compute the variance. |
| `keepdims` | A boolean, whether to keep the dimensions or not. If `keepdims` is `False`, the rank of the tensor is reduced by 1. If `keepdims` is `True`, the reduced dimension is retained with length 1. |

<br />

<br />

<br />

<br />

| ## Returns ||
|---|---|
| A tensor with the variance of elements of `x`. ||

<br />