File tree Expand file tree Collapse file tree 2 files changed +22
-4
lines changed Expand file tree Collapse file tree 2 files changed +22
-4
lines changed Original file line number Diff line number Diff line change @@ -38,6 +38,9 @@ struct SkipException <: Exception end
38
38
Call `Flux.skip()` in a callback to indicate when a callback condition is met.
39
39
This will trigger the train loop to skip the current data point and not update with the calculated gradient.
40
40
41
+ !!! note
42
+ `Flux.skip()` will be removed from Flux 0.14
43
+
41
44
# Examples
42
45
```julia
43
46
cb = function ()
46
49
```
47
50
"""
48
51
function skip ()
52
+ Base. depwarn (""" Flux.skip() will be removed from Flux 0.14.
53
+ and should be replaced with `continue` in an ordinary `for` loop.""" , :skip )
49
54
throw (SkipException ())
50
55
end
51
56
@@ -58,6 +63,9 @@ struct StopException <: Exception end
58
63
Call `Flux.stop()` in a callback to indicate when a callback condition is met.
59
64
This will trigger the train loop to stop and exit.
60
65
66
+ !!! note
67
+ `Flux.stop()` will be removed from Flux 0.14. It should be replaced with `break` in an ordinary `for` loop.
68
+
61
69
# Examples
62
70
```julia
63
71
cb = function ()
66
74
```
67
75
"""
68
76
function stop ()
77
+ Base. depwarn (""" Flux.stop() will be removed from Flux 0.14.
78
+ It should be replaced with `break` in an ordinary `for` loop.""" , :stop )
69
79
throw (StopException ())
70
80
end
71
81
140
150
Run `body` `N` times. Mainly useful for quickly doing multiple epochs of
141
151
training in a REPL.
142
152
153
+ !!! note
154
+ The macro `@epochs` will be removed from Flux 0.14. Please just write an ordinary `for` loop.
155
+
143
156
# Examples
144
- ```jldoctest
157
+ ```julia
145
158
julia> Flux.@epochs 2 println("hello")
146
159
[ Info: Epoch 1
147
160
hello
@@ -150,6 +163,8 @@ hello
150
163
```
151
164
"""
152
165
macro epochs (n, ex)
166
+ Base. depwarn (""" The macro `@epochs` will be removed from Flux 0.14.
167
+ As an alternative, you can write a simple `for i in 1:epochs` loop.""" , Symbol (" @epochs" ), force= true )
153
168
:(@progress for i = 1 : $ (esc (n))
154
169
@info " Epoch $i "
155
170
$ (esc (ex))
Original file line number Diff line number Diff line change @@ -648,7 +648,8 @@ julia> loss() = rand();
648
648
julia> trigger = Flux.patience(() -> loss() < 1, 3);
649
649
650
650
651
- julia> Flux.@epochs 10 begin
651
+ julia> for i in 1:10
652
+ @info "Epoch \$ i"
652
653
trigger() && break
653
654
end
654
655
[ Info: Epoch 1
@@ -685,7 +686,8 @@ julia> loss = let l = 0
685
686
julia> es = Flux.early_stopping(loss, 3);
686
687
687
688
688
- julia> Flux.@epochs 10 begin
689
+ julia> for i in 1:10
690
+ @info "Epoch \$ i"
689
691
es() && break
690
692
end
691
693
[ Info: Epoch 1
@@ -726,7 +728,8 @@ julia> f = let v = 10
726
728
julia> trigger = Flux.plateau(f, 3; init_score=10, min_dist=18);
727
729
728
730
729
- julia> Flux.@epochs 10 begin
731
+ julia> for i in 1:10
732
+ @info "Epoch \$ i"
730
733
trigger() && break
731
734
end
732
735
[ Info: Epoch 1
You can’t perform that action at this time.
0 commit comments