Skip to content

Commit 6c80759

Browse files
authored
adjust test tolerances for new isapprox behavior (#190)
1 parent 2fa2a0f commit 6c80759

File tree

3 files changed

+4
-4
lines changed

3 files changed

+4
-4
lines changed

test/HessianTest.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ for f in DiffBase.VECTOR_TO_NUMBER_FUNCS
7878
g = ForwardDiff.gradient(f, X)
7979
h = ForwardDiff.hessian(f, X)
8080
# finite difference approximation error is really bad for Hessians...
81-
@test_approx_eq_eps h Calculus.hessian(f, X) 0.01
81+
@test isapprox(h, Calculus.hessian(f, X), atol=0.02)
8282
for c in CHUNK_SIZES
8383
println(" ...testing $f with chunk size = $c")
8484
cfg = ForwardDiff.HessianConfig{c}(X)

test/JacobianTest.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ end
9191
for f in DiffBase.ARRAY_TO_ARRAY_FUNCS
9292
v = f(X)
9393
j = ForwardDiff.jacobian(f, X)
94-
@test_approx_eq_eps j Calculus.jacobian(x -> vec(f(x)), X, :forward) FINITEDIFF_ERROR
94+
@test isapprox(j, Calculus.jacobian(x -> vec(f(x)), X, :forward), atol=FINITEDIFF_ERROR)
9595
for c in CHUNK_SIZES
9696
cfg = JacobianConfig{c}(X)
9797

@@ -114,7 +114,7 @@ for f! in DiffBase.INPLACE_ARRAY_TO_ARRAY_FUNCS
114114
v = zeros(Y)
115115
f!(v, X)
116116
j = ForwardDiff.jacobian(f!, zeros(Y), X)
117-
@test_approx_eq_eps j Calculus.jacobian(x -> (y = zeros(Y); f!(y, x); vec(y)), X, :forward) FINITEDIFF_ERROR
117+
@test isapprox(j, Calculus.jacobian(x -> (y = zeros(Y); f!(y, x); vec(y)), X, :forward), atol=FINITEDIFF_ERROR)
118118
for c in CHUNK_SIZES
119119
cfg = JacobianConfig{c}(X)
120120
ycfg = JacobianConfig{c}(zeros(Y), X)

test/utils.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,4 +10,4 @@ const XLEN = CHUNK_THRESHOLD + 1
1010
const YLEN = div(CHUNK_THRESHOLD, 2) + 1
1111
const X, Y = rand(XLEN), rand(YLEN)
1212
const CHUNK_SIZES = (1, div(CHUNK_THRESHOLD, 3), div(CHUNK_THRESHOLD, 2), CHUNK_THRESHOLD, CHUNK_THRESHOLD + 1)
13-
const FINITEDIFF_ERROR = 1.5e-5
13+
const FINITEDIFF_ERROR = 3e-5

0 commit comments

Comments
 (0)