Merge #936
936: Avoid unnecessary conversion r=MikeInnes a=baggepinnen This initialization works for both cpu and gpu Co-authored-by: Fredrik Bagge Carlson <baggepinnen@gmail.com>
This commit is contained in:
commit
8638bcdcd7
|
@ -283,7 +283,7 @@ ADAGrad(η = 0.1) = ADAGrad(η, IdDict())
|
|||
|
||||
function apply!(o::ADAGrad, x, Δ)
|
||||
η = o.eta
|
||||
acc = get!(o.acc, x, fill(ϵ, size(x)))::typeof(x)
|
||||
acc = get!(o.acc, x, fill!(zero(x), ϵ))::typeof(x)
|
||||
@. acc += Δ^2
|
||||
@. Δ *= η / (√acc + ϵ)
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue