tf.keras.regularizers.l2

TensorFlow 1 version View source on GitHub

Create a regularizer that applies an L2 regularization penalty.

tf.keras.regularizers.l2(
    l=0.01
)

Used in the notebooks

Used in the guide Used in the tutorials

The L2 regularization penalty is computed as:

\(\ell_2\,\,penalty =\ell_2\sum_{i=0}^nx_i^2\)

Arguments:

  • l: Float; L2 regularization factor.

Returns:

An L2 Regularizer with the given regularization factor.