epochs util

This commit is contained in:
Mike J Innes 2018-02-16 11:17:57 +00:00
parent 7aa6854c64
commit 5e861101f3

View File

@ -129,3 +129,24 @@ function jacobian(m,x)
end
J'
end
"""
@epochs N body
Run `body` `N` times. Mainly useful for quickly doing multiple epochs of
training in a REPL.
```julia
julia> @epochs 2 println("hello")
INFO: Epoch 1
hello
INFO: Epoch 2
hello
```
"""
macro epochs(n, ex)
:(@progress for i = 1:$(esc(n))
info("Epoch $i")
$(esc(ex))
end)
end