Skip to content

Commit

Permalink
Merge FluxML#936
Browse files Browse the repository at this point in the history
936: Avoid unnecessary conversion r=MikeInnes a=baggepinnen

This initialization works for both cpu and gpu

Co-authored-by: Fredrik Bagge Carlson <[email protected]>
  • Loading branch information
bors[bot] and baggepinnen authored Nov 19, 2019
2 parents 967cc1c + 2da22f3 commit 8638bcd
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/optimise/optimisers.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 8638bcd

Please sign in to comment.