fixed throwing exception
This commit is contained in:
parent
887bfad312
commit
2aa057ec08
@ -36,8 +36,8 @@ Multiple optimisers and callbacks can be passed to `opt` and `cb` as arrays.
|
|||||||
function train!(loss, data, opt; cb = () -> ())
|
function train!(loss, data, opt; cb = () -> ())
|
||||||
cb = try
|
cb = try
|
||||||
runall(cb)
|
runall(cb)
|
||||||
catch e
|
catch ex
|
||||||
if e isa StopException || rethrow(e)
|
if ex isa StopException || rethrow(ex)
|
||||||
@info "Stop Condition Met"
|
@info "Stop Condition Met"
|
||||||
return :stop
|
return :stop
|
||||||
opt = runall(opt)
|
opt = runall(opt)
|
||||||
|
@ -157,5 +157,5 @@ end
|
|||||||
struct StopException <: Exception end
|
struct StopException <: Exception end
|
||||||
|
|
||||||
function stop()
|
function stop()
|
||||||
throw(StopException)
|
throw(StopException())
|
||||||
end
|
end
|
Loading…
Reference in New Issue
Block a user