<br />

|---|
| [![](https://www.tensorflow.org/images/GitHub-Mark-32px.png) View source on GitHub](https://github.com/keras-team/keras/tree/v3.15.1/keras/src/ops/numpy.py#L9185-L9201) |

Compute the variance along the specified axes.

#### View aliases


**Main aliases**

[`tf.keras.ops.numpy.var`](https://www.tensorflow.org/api_docs/python/tf/keras/ops/var)

<br />

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

<br />

<br />

<br />

| ## Args ||
|---|---|
| `x` | Input tensor. |
| `axis` | Axis or axes along which the variance is computed. The default is to compute the variance of the flattened tensor. |
| `keepdims` | If this is set to `True`, the axes which are reduced are left in the result as dimensions with size one. |

<br />

<br />

<br />

<br />

| ## Returns ||
|---|---|
| Output tensor containing the variance. ||

<br />