From 4274352c53bd885d9c2d053223656d9286bec724 Mon Sep 17 00:00:00 2001 From: Lyndon White Date: Mon, 12 Oct 2020 22:29:28 +0100 Subject: [PATCH] fix tests using nondifferentials remove debug statement --- test/rulesets/Base/base.jl | 8 ++++---- test/rulesets/Base/evalpoly.jl | 5 ++--- test/rulesets/packages/SpecialFunctions.jl | 2 +- test/runtests.jl | 1 + 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/test/rulesets/Base/base.jl b/test/rulesets/Base/base.jl index 21a97c256..484000b07 100644 --- a/test/rulesets/Base/base.jl +++ b/test/rulesets/Base/base.jl @@ -43,7 +43,7 @@ test_scalar(acscd, 1/x) test_scalar(acotd, 1/x) end - + @testset "sinc" for x = (0.0, 0.434, Complex(0.434, 0.25)) test_scalar(sinc, x) end @@ -126,14 +126,14 @@ frule_test(identity, (randn(T, 4), randn(T, 4))) frule_test( identity, - (Composite{Tuple}(randn(T, 3)...), Composite{Tuple}(randn(T, 3)...)) + (Tuple(randn(T, 3)), Composite{Tuple{T, T, T}}(randn(T, 3)...)) ) rrule_test(identity, randn(T), (randn(T), randn(T))) rrule_test(identity, randn(T, 4), (randn(T, 4), randn(T, 4))) rrule_test( - identity, Tuple(randn(T, 3)), - (Composite{Tuple}(randn(T, 3)...), Composite{Tuple}(randn(T, 3)...)) + identity, Composite{Tuple{T, T, T}}(randn(T, 3)...), + (Tuple(randn(T, 3)), Composite{Tuple{T, T, T}}(randn(T, 3)...)) ) end diff --git a/test/rulesets/Base/evalpoly.jl b/test/rulesets/Base/evalpoly.jl index 48c12fa02..6731f321a 100644 --- a/test/rulesets/Base/evalpoly.jl +++ b/test/rulesets/Base/evalpoly.jl @@ -27,9 +27,8 @@ Ω = evalpoly(x, p) Ω̄ = randn(T, size(Ω)...) frule_test(evalpoly, (x, ẋ), (p, ṗ)) - frule_test(evalpoly, (x, ẋ), (Tuple(p), Tuple(ṗ))) + frule_test(evalpoly, (x, ẋ), (Tuple(p), rand_tangent(Tuple(p)))) rrule_test(evalpoly, Ω̄, (x, x̄), (p, p̄)) - rrule_test(evalpoly, Ω̄, (x, x̄), (Tuple(p), Tuple(p̄))) + rrule_test(evalpoly, Ω̄, (x, x̄), (Tuple(p), rand_tangent(Tuple(p)))) end end - diff --git a/test/rulesets/packages/SpecialFunctions.jl b/test/rulesets/packages/SpecialFunctions.jl index 637a0aeeb..3ea35da44 100644 --- a/test/rulesets/packages/SpecialFunctions.jl +++ b/test/rulesets/packages/SpecialFunctions.jl @@ -50,7 +50,7 @@ end isreal(x) || continue Δx, x̄ = randn(2) - Δz = (randn(), randn()) + Δz = Composite{Tuple{Float64, DoesNotExist}}(randn(), Zero()) frule_test(SpecialFunctions.logabsgamma, (x, Δx)) rrule_test(SpecialFunctions.logabsgamma, Δz, (x, x̄)) diff --git a/test/runtests.jl b/test/runtests.jl index 154306904..3c815ccc1 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -5,6 +5,7 @@ using ChainRulesTestUtils using ChainRulesTestUtils: _fdm using Compat: only using FiniteDifferences +using FiniteDifferences: rand_tangent using LinearAlgebra using LinearAlgebra.BLAS using LinearAlgebra: dot