Merge pull request #796 from dhairyagandhi96/nadam
Pick beta from the state - NADAM
This commit is contained in:
commit
e88440974b
@ -213,8 +213,7 @@ NADAM(η = 0.001, β = (0.9, 0.999)) = NADAM(η, β, IdDict())
|
|||||||
|
|
||||||
function apply!(o::NADAM, x, Δ)
|
function apply!(o::NADAM, x, Δ)
|
||||||
η, β = o.eta, o.beta
|
η, β = o.eta, o.beta
|
||||||
β1p, β2p = o.beta
|
mt, vt, (β1p, β2p) = get!(o.state, x, (zero(x), zero(x), o.beta))
|
||||||
mt, vt = get!(o.state, x, (zero(x), zero(x)))
|
|
||||||
@. mt = β[1] * mt + (1 - β[1]) * Δ
|
@. mt = β[1] * mt + (1 - β[1]) * Δ
|
||||||
@. vt = β[2] * vt + (1 - β[2]) * Δ^2
|
@. vt = β[2] * vt + (1 - β[2]) * Δ^2
|
||||||
@. Δ = (β[1] * mt / (1 - β[1] * β1p) + (1 - β[1]) * Δ / (1 - β1p)) / (√(vt * β[2] / (1 - β2p)) + ϵ) * η
|
@. Δ = (β[1] * mt / (1 - β[1] * β1p) + (1 - β[1]) * Δ / (1 - β1p)) / (√(vt * β[2] / (1 - β2p)) + ϵ) * η
|
||||||
|
Loading…
Reference in New Issue
Block a user