# tf.keras.layers.UnitNormalization

<br />

|---|
| [![](https://www.tensorflow.org/images/GitHub-Mark-32px.png) View source on GitHub](https://github.com/keras-team/keras/tree/v2.14.0/keras/layers/normalization/unit_normalization.py#L27-L75) |

Unit normalization layer.

Inherits From: [`Layer`](https://www.tensorflow.org/versions/r2.14/api_docs/python/tf/keras/layers/Layer), [`Module`](https://www.tensorflow.org/versions/r2.14/api_docs/python/tf/Module)

    tf.keras.layers.UnitNormalization(
        axis=-1, **kwargs
    )

Normalize a batch of inputs so that each input in the batch has a L2 norm
equal to 1 (across the axes specified in `axis`).

#### Example:

    data = tf.constant(np.arange(6).reshape(2, 3), dtype=tf.float32)
    normalized_data = tf.keras.layers.UnitNormalization()(data)
    print(tf.reduce_sum(normalized_data[0, :] ** 2).numpy())
    1.0

<br />

<br />

<br />

| ## Args ||
|---|---|
| `axis` | Integer or list/tuple. The axis or axes to normalize across. Typically, this is the features axis or axes. The left-out axes are typically the batch axis or axes. `-1` is the last dimension in the input. Defaults to `-1`. |

<br />