added docs

This commit is contained in:
Dhairya Gandhi 2018-08-20 14:20:33 +05:30
parent 51578177a5
commit 756207e782

View File

@ -15,7 +15,20 @@ macro interrupts(ex)
end
struct StopException <: Exception end
"""
stop()
Call `stop()` in a callback to indicate when a callback condition is met.
This would trigger the train loop to stop and exit.
```julia
# Example callback:
cb = function ()
accuracy() > 0.9 && stop()
end
```
"""
function stop()
throw(StopException())
end
@ -52,7 +65,6 @@ function train!(loss, data, opt; cb = () -> ())
@info "Stop condition met"
break
else
println(ex)
rethrow(ex)
end
end