File tree Expand file tree Collapse file tree 2 files changed +8
-4
lines changed Expand file tree Collapse file tree 2 files changed +8
-4
lines changed Original file line number Diff line number Diff line change 11name = " Optimisers"
22uuid = " 3bd65402-5787-11e9-1adc-39752487f4e2"
33authors = [" Mike J Innes <mike.j.innes@gmail.com>" ]
4- version = " 0.2.2 "
4+ version = " 0.2.1 "
55
66[deps ]
77ChainRulesCore = " d360d2e6-b24c-11e9-a2a3-2a2ae2dbcce4"
Original file line number Diff line number Diff line change @@ -442,20 +442,24 @@ end
442442"""
443443 WeightDecay(γ = 5f-4)
444444
445- Decay weights by `γ`.
445+ Decay weights by ``γ``, that is, add `γ .* x` to the gradient `x̄` which will be
446+ subtracted from `x`.
447+
448+ Typically composed with other optimisers as the first transformation in an [`OptimiserChain`](@ref).
449+ This is equivalent to adding ``L_2`` regularization with coefficient ``γ`` to the loss.
446450
447451# Parameters
448452- Weight decay (`γ`): Decay applied to weights during optimisation.
449453"""
450454struct WeightDecay{T}
451- wd :: T
455+ gamma :: T
452456end
453457WeightDecay () = WeightDecay (5f-4 )
454458
455459init (o:: WeightDecay , x:: AbstractArray ) = nothing
456460
457461function apply! (o:: WeightDecay , state, x, dx)
458- dx′ = @lazy dx + o. wd * x
462+ dx′ = @lazy dx + o. gamma * x
459463
460464 return state, dx′
461465end
You can’t perform that action at this time.
0 commit comments