epochs util
This commit is contained in:
parent
7aa6854c64
commit
5e861101f3
21
src/utils.jl
21
src/utils.jl
@ -129,3 +129,24 @@ function jacobian(m,x)
|
|||||||
end
|
end
|
||||||
J'
|
J'
|
||||||
end
|
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
|
||||||
|
Loading…
Reference in New Issue
Block a user