Skip to content

Commit 2994d74

Browse files
committed
remove issingletontype purity check, too strict
1 parent d730bb6 commit 2994d74

File tree

1 file changed

+1
-3
lines changed

1 file changed

+1
-3
lines changed

src/train.jl

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import ..Flux.Optimise: train!, update! # during 0.13, we add methods to the ol
88

99
export setup, @train_autodiff
1010

11-
using ProgressLogging: @progress, @withprogress, @logprogress # TODO add progress logging again
11+
using ProgressLogging: @progress, @withprogress, @logprogress
1212
using Zygote: Zygote, Params
1313

1414
"""
@@ -94,8 +94,6 @@ Note that the built-in loss functions accept 3 arguments, allowing for instance
9494
Note that callback functions are not supported. But arbitrary code can be inserted into the loop.
9595
"""
9696
function train!(loss, model, data, opt)
97-
Base.issingletontype(typeof(loss)) || error("""train! with explicit parameter expects a pure loss function.
98-
It must not close over the model, like loss(x,y) = mse(model(x), y). """)
9997
losses = Float32[]
10098
@withprogress for (i,d) in enumerate(data)
10199
d isa Tuple || error("""train! expects as data an iterator producing tuples, but got $(typeof(d)).

0 commit comments

Comments
 (0)