Skip to content

Commit 04dfc15

Browse files
authored
Revert "Revert "Tighten up a bunch of test accurasy requirements now that have FiniteDifferences v0.11.4 (#315)""
1 parent f550f8d commit 04dfc15

File tree

4 files changed

+8
-11
lines changed

4 files changed

+8
-11
lines changed

Project.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ Statistics = "10745b16-79ce-11e8-11f9-7d13ad32a3b2"
1616
ChainRulesCore = "0.9.16"
1717
ChainRulesTestUtils = "0.5"
1818
Compat = "3"
19-
FiniteDifferences = "0.11"
19+
FiniteDifferences = "0.11.4"
2020
Reexport = "0.2"
2121
Requires = "0.5.2, 1"
2222
julia = "1"

test/rulesets/Base/fastmath_able.jl

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,6 @@ end
4141
# Do not add any tests here for functions that do not have varients in Base.FastMath
4242
# e.g. do not add `foo` unless `Base.FastMath.foo_fast` exists.
4343
const FASTABLE_AST = quote
44-
is_fastmath_mode = sin === Base.FastMath.sin_fast
45-
4644
@testset "Trig" begin
4745
@testset "Basics" for x = (Float64(π)-0.01, Complex(π, π/2))
4846
test_scalar(sin, x)
@@ -106,7 +104,7 @@ const FASTABLE_AST = quote
106104
complex_jacobian_test(angle, z)
107105
end
108106
@test frule((Zero(), randn()), angle, randn())[2] === Zero()
109-
@test rrule(angle, randn())[2](randn())[2] === Zero()
107+
@test rrule(angle, randn())[2](randn())[2] === Zero()
110108

111109
# test that real primal with complex tangent gives complex tangent
112110
ΔΩ = randn(ComplexF64)
@@ -122,7 +120,7 @@ const FASTABLE_AST = quote
122120
for x in (-4.1, 6.4, 0.0, 0.0 + 0.0im, 0.5 + 0.25im)
123121
test_scalar(+, x)
124122
test_scalar(-, x)
125-
test_scalar(atan, x; rtol=(is_fastmath_mode ? 1e-7 : 1e-9))
123+
test_scalar(atan, x)
126124
end
127125
end
128126

@@ -141,9 +139,8 @@ const FASTABLE_AST = quote
141139
y, Δy, ȳ = rand(T, 3)
142140
Δz = randn(typeof(f(x, y)))
143141

144-
# some tests struggle in fast_math mode to get accurasy so we relax it some.
145-
frule_test(f, (x, Δx), (y, Δy); rtol=(is_fastmath_mode ? 1e-5 : 1e-7))
146-
rrule_test(f, Δz, (x, x̄), (y, ȳ); rtol=(is_fastmath_mode ? 1e-5 : 1e-7))
142+
frule_test(f, (x, Δx), (y, Δy))
143+
rrule_test(f, Δz, (x, x̄), (y, ȳ))
147144
end
148145

149146
@testset "$f(x::$T, y::$T) type check" for f in (/, +, -,\, hypot, ^), T in (Float32, Float64)

test/rulesets/LinearAlgebra/blas.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333
n = 10
3434
x, ẋ, x̄ = randn(T, n), randn(T, n), randn(T, n)
3535
frule_test(BLAS.nrm2, (x, ẋ))
36-
rrule_test(BLAS.nrm2, randn(), (x, x̄); rtol=1e-7)
36+
rrule_test(BLAS.nrm2, randn(), (x, x̄))
3737
end
3838
end
3939

test/rulesets/LinearAlgebra/factorization.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -92,10 +92,10 @@ using ChainRules: level2partition, level3partition, chol_blocked_rev, chol_unblo
9292
ΔF = unthunk(dF)
9393
_, dX = dX_pullback(ΔF)
9494
X̄_ad = dot(unthunk(dX), V)
95-
X̄_fd = central_fdm(5, 1)(0.000_001) do ε
95+
X̄_fd = _fdm(0.0) do ε
9696
dot(Ȳ, getproperty(cholesky(X .+ ε .* V), p))
9797
end
98-
@test X̄_ad X̄_fd rtol=1e-4
98+
@test X̄_ad X̄_fd rtol=1e-6 atol=1e-6
9999
end
100100
end
101101
@testset "helper functions" begin

0 commit comments

Comments
 (0)