tf.keras.ops.layer_normalization
Stay organized with collections
Save and categorize content based on your preferences.
Layer normalization layer (Ba et al., 2016).
tf.keras.ops.layer_normalization(
x, gamma=None, beta=None, axis=-1, epsilon=None, **kwargs
)
Normalize the activations of the previous layer for each given example in a
batch independently, rather than across a batch like Batch Normalization.
i.e. applies a transformation that maintains the mean activation within each
example close to 0 and the activation standard deviation close to 1.
Args |
x
|
Input tensor.
|
gamma
|
Optional scaling factor for the normalization.
|
beta
|
Optional add offset for the normalized tensor.
|
axis
|
The axis or axes along which to perform normalization. Default to
-1.
|
epsilon
|
A lower bound value for the norm.
Defaults to backend.epsilon().
|
Returns |
|
The normalized array.
|
Example:
x = keras.ops.arange(5, dtype="float32")
keras.ops.layer_normalization(x)
array([-1.4142135, -0.70710677, 0.0, 0.7071067, 1.4142135])
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates. Some content is licensed under the numpy license.
Last updated 2026-10-31 UTC.
[null,null,["Last updated 2026-10-31 UTC."],[],[]]