Skip to content

Commit 43b426c

Browse files
committed
add tests, frule is broken
1 parent b458a23 commit 43b426c

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

test/runtests.jl

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
using Diffractor
2-
using Diffractor: var"'", ∂⃖
2+
using Diffractor: var"'", ∂⃖, DiffractorRuleConfig
33
using ChainRules
44
using ChainRulesCore
5-
using ChainRules: ZeroTangent, NoTangent
5+
using ChainRules: ZeroTangent, NoTangent, frule_via_ad, rrule_via_ad
66
using Symbolics
77

88
using Test
@@ -195,4 +195,13 @@ end
195195
# Issue #40 - Symbol type parameters not properly quoted
196196
@test Diffractor.∂⃖recurse{1}()(Val{:transformations})[1] === Val{:transformations}()
197197

198+
# PR # 45 - Calling back into AD from ChainRules
199+
y45, back45 = rrule_via_ad(DiffractorRuleConfig(), x -> log(exp(x)), 2.0)
200+
@test y45 2.0
201+
@test back45(1) == (ZeroTangent(), 1.0)
202+
203+
# z45, delta45 = frule_via_ad(DiffractorRuleConfig(), (0,1), x -> log(exp(x)), 2.0)
204+
# @test z45 ≈ 2.0
205+
# @test delta45 ≈ 1.0
206+
198207
include("pinn.jl")

0 commit comments

Comments
 (0)