Flux.jl/src/optimise/train.jl

14 lines
252 B
Julia
Raw Normal View History

2017-09-03 06:44:32 +00:00
using Juno
2017-08-31 16:36:18 +00:00
using Flux.Tracker: back!
2017-09-02 03:59:44 +00:00
function train!(m, data, opt; epoch = 1, cb = () -> ())
2017-09-03 06:44:32 +00:00
@progress for e in 1:epoch
2017-08-24 10:42:29 +00:00
epoch > 1 && info("Epoch $e")
2017-09-03 06:44:32 +00:00
@progress for (x, y) in data
2017-09-02 03:59:44 +00:00
back!(m(x, y))
2017-09-01 21:06:51 +00:00
opt()
2017-09-02 03:59:44 +00:00
cb()
2017-08-24 10:42:29 +00:00
end
end
end