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:
bors[bot] 2019-11-19 09:05:23 +00:00 committed by GitHub
commit 8638bcdcd7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 1 additions and 1 deletions

View File

@ -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