regularizer

append_regularization_ops

paddle.v2.fluid.regularizer.append_regularization_ops(parameters_and_grads, regularization=None)

Create and add backward regularization Operators

Creates and adds backward regularization operators in the BlockDesc. This will add gradients of the regularizer function to the gradients of the parameters and return these modified gradients. This is the same as implementing weight decay in optimizers for regularization.

参数:
  • parameters_and_grads – A list of (parameters, gradients) pairs that need to be regularized.
  • regularization – A global regularizer. If the parameter is not set. It will be applied with regularizer.
返回:

list of (parameters, gradients) pair with the regularized gradient

Raises:

Exception – Unknown regularization type

L1Decay

paddle.v2.fluid.regularizer.L1Decay

L1DecayRegularizer 的别名

L2Decay

paddle.v2.fluid.regularizer.L2Decay

L2DecayRegularizer 的别名