Merge pull request #681 from dellison/stopdoc

add Flux.stop to training docs
This commit is contained in:
Mike J Innes 2019-03-25 15:07:07 +00:00 committed by GitHub
commit eeed8b24c3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
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
```