Skip to content

Commit

Permalink
fix tests using nondifferentials
Browse files Browse the repository at this point in the history
remove debug statement
  • Loading branch information
oxinabox committed Oct 14, 2020
1 parent c4d7843 commit 4274352
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 8 deletions.
8 changes: 4 additions & 4 deletions test/rulesets/Base/base.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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

Expand Down
5 changes: 2 additions & 3 deletions test/rulesets/Base/evalpoly.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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()))
rrule_test(evalpoly, Ω̄, (x, x̄), (Tuple(p), rand_tangent(Tuple(p))))
end
end

2 changes: 1 addition & 1 deletion test/rulesets/packages/SpecialFunctions.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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̄))
Expand Down
1 change: 1 addition & 0 deletions test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 4274352

Please sign in to comment.