Skip to content

Commit b368cb4

Browse files
test: use random seed
1 parent ac6a7e6 commit b368cb4

2 files changed

Lines changed: 9 additions & 4 deletions

File tree

test/AD_compatibility.jl

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,9 @@ using ForwardDiff
55
using Test
66
using GaussianMixtures
77
using Flux
8+
using Random
9+
10+
Random.seed!(42)
811

912
@testset "ForwardDiff" begin
1013
@testset "1D" begin

test/extensions.jl

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -300,6 +300,8 @@ end
300300
using Flux
301301
using Flux.Optimisers
302302
using LinearAlgebra
303+
using Random
304+
Random.seed!(42)
303305

304306
@testset "1D without gradients" begin
305307
model = Chain(
@@ -515,11 +517,11 @@ end
515517
y = f.(x)
516518
dydx = reshape(df.(x), :, 1)
517519
model = Chain(
518-
Dense(1, 20, relu),
519-
Dense(20, 20, relu),
520-
Dense(20, 1)
520+
Dense(1, 12, relu),
521+
Dense(12, 12, relu),
522+
Dense(12, 1)
521523
) |> Flux.f64
522-
genn = GENNSurrogate(x, y, lb, ub, dydx = dydx, model = model, is_normalize = true, n_epochs = 500)
524+
genn = GENNSurrogate(x, y, lb, ub, dydx = dydx, model = model, is_normalize = true, n_epochs = 100)
523525
val = genn(5.0)
524526
@test val isa Number
525527
@test isapprox(val, f(5.0), atol = 2.0)

0 commit comments

Comments
 (0)