-
Notifications
You must be signed in to change notification settings - Fork 24
Specific preparation values for DifferentiationInterfaceTest.Scenario
s
#771
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Hi Penelope, I didn't know anyone else was actually using DifferentiationInterfaceTest, that's why the interface is still a bit raw. Perhaps the |
We are not actually using it 🥲 (the tl;dr is that we want to test You're the expert here, but as a potential user I might be inclined towards extra fields |
With #786 you can do: using DifferentiationInterface, DifferentiationInterfaceTest
using ForwardDiff: ForwardDiff
using ReverseDiff: ReverseDiff
f(x) = x[1] > 0 ? x[2] : x[2]^2
scen = Scenario{:gradient,:out}(
f, [-5.0, 5.0]; prep_args=(; x=[5.0, -5.0], contexts=()), res1=[0.0, 10.0]
)
backends = [
AutoForwardDiff(), AutoReverseDiff(; compile=false), AutoReverseDiff(; compile=true)
]
test_differentiation(backends, [scen]) and get the expected results: Test Summary: | Pass Fail Total Time
Testing correctness | 60 12 72 0.2s
AutoForwardDiff() | 24 24 0.0s
AutoReverseDiff() | 24 24 0.0s
AutoReverseDiff(compile=true) | 12 12 24 0.2s
gradient | 12 12 24 0.2s
Scenario{:gradient,:out} f : Vector{Float64} -> Float64 | 12 12 24 0.2s
Correctness | 12 12 24 0.2s |
Hello @gdalle!
I was wondering if there is any way to specify the values at which the gradient preparation is carried out when constructing a
Scenario
. For example, this would be useful to (reproducibly) demonstrate that compiled ReverseDiff can potentially give incorrect values:The text was updated successfully, but these errors were encountered: