add Flux.stop to training docs

This commit is contained in:
David Ellison 2019-03-11 19:52:05 -07:00
parent 22cb732657
commit 263a3248f6
1 changed files with 8 additions and 0 deletions

View File

@ -93,3 +93,11 @@ evalcb() = @show(loss(test_x, test_y))
Flux.train!(objective, ps, data, opt,
cb = throttle(evalcb, 5))
```
Calling `Flux.stop()` in a callback will exit the training loop early.
```julia
cb = function ()
accuracy() > 0.9 && Flux.stop()
end
```