chainer.optimizer_hooks.WeightDecay

class chainer.optimizer_hooks.WeightDecay(rate)[source]

Optimizer/UpdateRule hook function for weight decay regularization.

This hook function adds a scaled parameter to the corresponding gradient. It can be used as a regularization.

Parameters:

rate (float) – Coefficient for the weight decay.

Variables:
  • rate (float) – Coefficient for the weight decay.
  • timing (string) – Specifies when this hook should be called by the Optimizer/UpdateRule. Valid values are ‘pre’ (before any updates) and ‘post’ (after any updates).

New in version 4.0.0: The timing parameter.

Methods

__call__(rule, param)[source]

Call self as a function.

Attributes

call_for_each_param = True
name = 'WeightDecay'
timing = 'pre'