handle epoch elsewhere
This commit is contained in:
parent
aeaa138b6d
commit
085d3aa9b4
@ -4,14 +4,11 @@ using Flux.Tracker: back!
|
|||||||
tocb(f) = f
|
tocb(f) = f
|
||||||
tocb(fs::AbstractVector) = () -> foreach(call, fs)
|
tocb(fs::AbstractVector) = () -> foreach(call, fs)
|
||||||
|
|
||||||
function train!(m, data, opt; epoch = 1, cb = () -> ())
|
function train!(m, data, opt; cb = () -> ())
|
||||||
cb = tocb(cb)
|
cb = tocb(cb)
|
||||||
@progress for e in 1:epoch
|
@progress for (x, y) in data
|
||||||
epoch > 1 && info("Epoch $e")
|
back!(m(x, y))
|
||||||
@progress for (x, y) in data
|
opt()
|
||||||
back!(m(x, y))
|
cb()
|
||||||
opt()
|
|
||||||
cb()
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
Loading…
Reference in New Issue
Block a user