<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/nn.py#L2422-L2478) |

Normalizes `x` by `mean` and `variance`.

#### View aliases


**Main aliases**

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

<br />

    tf.keras.ops.batch_normalization(
        x, mean, variance, axis, offset=None, scale=None, epsilon=0.001
    )

This op is typically used by the batch normalization step in a neural
network. It normalizes the input tensor along the given axis.

<br />

<br />

<br />

| ## Args ||
|---|---|
| `x` | Input tensor. |
| `mean` | A mean vector of the same length as the `axis` dimension of the input thensor. |
| `variance` | A variance vector of the same length as the `axis` dimension of the input tensor. |
| `axis` | Integer, the axis that should be normalized. |
| `offset` | An offset vector of the same length as the `axis` dimension of the input tensor. If not `None`, `offset` is added to the normalized tensor. Defaults to `None`. |
| `scale` | A scale vector of the same length as the `axis` dimension of the input tensor. If not `None`, the normalized tensor is multiplied by `scale`. Defaults to `None`. |
| `epsilon` | Small float added to variance to avoid dividing by zero. Defaults to 1e-3. |

<br />

<br />

<br />

<br />

| ## Returns ||
|---|---|
| The normalized tensor. ||

<br />

#### Example:

    x = keras.ops.convert_to_tensor(
        [[0.1, 0.2, 0.3], [0.4, 0.5, 0.6], [0.7, 0.8, 0.9]]
    )
    keras.ops.batch_normalization(
        x,
        mean=[0.4, 0.5, 0.6],
        variance=[0.67, 0.67, 0.67],
        axis=-1
    )
    array([[-3.6624e-01, -3.6624e-01, -3.6624e-01],
           [-4.6445e-09,  0.0000e+00, -1.8578e-08],
           [ 3.6624e-01,  3.6624e-01,  3.6624e-01]])