handle epoch elsewhere

This commit is contained in:
Mike J Innes 2017-09-07 00:29:55 -04:00
parent aeaa138b6d
commit 085d3aa9b4
1 changed files with 5 additions and 8 deletions

View File

@ -4,14 +4,11 @@ using Flux.Tracker: back!
tocb(f) = f
tocb(fs::AbstractVector) = () -> foreach(call, fs)
function train!(m, data, opt; epoch = 1, cb = () -> ())
function train!(m, data, opt; cb = () -> ())
cb = tocb(cb)
@progress for e in 1:epoch
epoch > 1 && info("Epoch $e")
@progress for (x, y) in data
back!(m(x, y))
opt()
cb()
end
@progress for (x, y) in data
back!(m(x, y))
opt()
cb()
end
end