diff --git a/src/optimise/train.jl b/src/optimise/train.jl index 3bf06d8f..2cc20268 100644 --- a/src/optimise/train.jl +++ b/src/optimise/train.jl @@ -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) diff --git a/src/utils.jl b/src/utils.jl index 1e119148..c746f391 100644 --- a/src/utils.jl +++ b/src/utils.jl @@ -157,5 +157,5 @@ end struct StopException <: Exception end function stop() - throw(StopException) + throw(StopException()) end \ No newline at end of file