re-add removed call function
This commit is contained in:
parent
5ec70fe29d
commit
392c3c942b
@ -11,6 +11,7 @@ function update!(opt, xs)
|
|||||||
end
|
end
|
||||||
|
|
||||||
# Callback niceties
|
# Callback niceties
|
||||||
|
call(f, xs...) = f(xs...)
|
||||||
runall(f) = f
|
runall(f) = f
|
||||||
runall(fs::AbstractVector) = () -> foreach(call, fs)
|
runall(fs::AbstractVector) = () -> foreach(call, fs)
|
||||||
|
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
using Flux.Optimise
|
using Flux.Optimise
|
||||||
|
using Flux.Optimise: runall
|
||||||
using Flux.Tracker
|
using Flux.Tracker
|
||||||
using Test
|
using Test
|
||||||
@testset "Optimise" begin
|
@testset "Optimise" begin
|
||||||
@ -50,4 +51,11 @@ end
|
|||||||
cb = Flux.throttle(() -> (i > 3 && Flux.stop()), 1))
|
cb = Flux.throttle(() -> (i > 3 && Flux.stop()), 1))
|
||||||
|
|
||||||
@test 3 < i < 50
|
@test 3 < i < 50
|
||||||
|
|
||||||
|
# Test multiple callbacks
|
||||||
|
x = 0
|
||||||
|
fs = [() -> (), () -> x = 1]
|
||||||
|
cbs = runall(fs)
|
||||||
|
cbs()
|
||||||
|
@test x == 1
|
||||||
end
|
end
|
||||||
|
Loading…
Reference in New Issue
Block a user