From 6c674043983dce5c90efe92c623e9f769dbf63f5 Mon Sep 17 00:00:00 2001 From: Mike Innes Date: Mon, 19 Aug 2019 15:44:51 +0100 Subject: [PATCH] update cleanup --- src/optimise/train.jl | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/optimise/train.jl b/src/optimise/train.jl index 123117a2..ae0f334c 100644 --- a/src/optimise/train.jl +++ b/src/optimise/train.jl @@ -7,14 +7,12 @@ function update!(x::AbstractArray, x̄) end function update!(opt, x, x̄) - if x̄ == nothing - x̄ = zeros(size(x)...) - end - update!(x, -apply!(opt, x, x̄)) + x .-= apply!(opt, x, x̄) end function update!(opt, xs::Params, gs) for x in xs + gs[x] == nothing && continue update!(opt, x, gs[x]) end end @@ -25,6 +23,7 @@ runall(f) = f runall(fs::AbstractVector) = () -> foreach(call, fs) struct StopException <: Exception end + """ stop()