MCPcopy Create free account
hub / github.com/pytorch/pytorch / add_weight_decay

Function add_weight_decay

caffe2/python/optimizer.py:2184–2197  ·  view source on GitHub ↗

Adds a decay to weights in the model. This is a form of L2 regularization. Args: weight_decay: strength of the regularization

(model, weight_decay)

Source from the content-addressed store, hash-verified

2182
2183
2184def add_weight_decay(model, weight_decay):
2185 """Adds a decay to weights in the model.
2186
2187 This is a form of L2 regularization.
2188
2189 Args:
2190 weight_decay: strength of the regularization
2191 """
2192 _build(
2193 model,
2194 WeightDecayBuilder(weight_decay=weight_decay),
2195 weights_only=True,
2196 use_param_info_optim=False,
2197 )
2198
2199
2200def build_sgd(

Callers 2

test_weight_decayMethod · 0.90

Calls 2

_buildFunction · 0.85
WeightDecayBuilderClass · 0.85

Tested by 2

test_weight_decayMethod · 0.72

Used in the wild real call sites across dependent graphs

searching dependent graphs…