Skip to content
This repository was archived by the owner on Sep 28, 2024. It is now read-only.

Commit defb9ca

Browse files
committed
update cb
1 parent e56f5d6 commit defb9ca

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

example/burgers.jl

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,13 +24,14 @@ n_test = 40
2424
loader_test = Flux.DataLoader((𝐱_test, 𝐲_test), batchsize=20, shuffle=false)
2525

2626
function loss_test()
27-
l = 0
27+
l = 0f0
2828
for (𝐱, 𝐲) in loader_test
29+
𝐱, 𝐲 = device(𝐱), device(𝐲)
2930
l += loss(𝐱, 𝐲)
3031
end
3132
@info "loss: $(l/length(loader_test))"
3233
end
3334

3435
data = [(𝐱, 𝐲) for (𝐱, 𝐲) in loader_train] |> device
3536
opt = Flux.Optimiser(WeightDecay(1f-4), Flux.ADAM(1f-3))
36-
Flux.@epochs 500 @time(Flux.train!(loss, params(m), data, opt))
37+
Flux.@epochs 500 @time(Flux.train!(loss, params(m), data, opt, cb=Flux.throttle(loss_test, 5)))

0 commit comments

Comments
 (0)