move epochs
This commit is contained in:
parent
5c7f856115
commit
5153cde847
@ -34,3 +34,24 @@ function train!(loss, data, opt; cb = () -> ())
|
|||||||
cb() == :stop && break
|
cb() == :stop && break
|
||||||
end
|
end
|
||||||
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
|
||||||
|
21
src/utils.jl
21
src/utils.jl
@ -153,24 +153,3 @@ 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