fixed throwing exception

This commit is contained in:
Dhairya Gandhi 2018-08-19 14:54:54 +05:30
parent 887bfad312
commit 2aa057ec08
2 changed files with 3 additions and 3 deletions

View File

@ -36,8 +36,8 @@ Multiple optimisers and callbacks can be passed to `opt` and `cb` as arrays.
function train!(loss, data, opt; cb = () -> ())
cb = try
runall(cb)
catch e
if e isa StopException || rethrow(e)
catch ex
if ex isa StopException || rethrow(ex)
@info "Stop Condition Met"
return :stop
opt = runall(opt)

View File

@ -157,5 +157,5 @@ end
struct StopException <: Exception end
function stop()
throw(StopException)
throw(StopException())
end