cb convenience

This commit is contained in:
Mike J Innes 2017-09-07 00:27:16 -04:00
parent e837bb0745
commit aeaa138b6d

View File

@ -1,7 +1,11 @@
using Juno using Juno
using Flux.Tracker: back! 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; epoch = 1, cb = () -> ())
cb = tocb(cb)
@progress for e in 1:epoch @progress for e in 1:epoch
epoch > 1 && info("Epoch $e") epoch > 1 && info("Epoch $e")
@progress for (x, y) in data @progress for (x, y) in data