Skip to content

Commit 71ea7fd

Browse files
authored
Fix and test ForwardDiff type stability (#473)
1 parent a1d9c26 commit 71ea7fd

2 files changed

Lines changed: 22 additions & 7 deletions

File tree

  • DifferentiationInterface

DifferentiationInterface/ext/DifferentiationInterfaceForwardDiffExt/onearg.jl

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -311,6 +311,24 @@ function DI.value_derivative_and_second_derivative!(
311311
return y, der, der2
312312
end
313313

314+
## HVP
315+
316+
function DI.prepare_hvp(f::F, backend::AutoForwardDiff, x, tx::Tangents) where {F}
317+
return DI.prepare_hvp(f, SecondOrder(backend, backend), x, tx)
318+
end
319+
320+
function DI.hvp(
321+
f::F, extras::HVPExtras, backend::AutoForwardDiff, x, tx::Tangents
322+
) where {F}
323+
return DI.hvp(f, extras, SecondOrder(backend, backend), x, tx)
324+
end
325+
326+
function DI.hvp!(
327+
f::F, tg::Tangents, extras::HVPExtras, backend::AutoForwardDiff, x, tx::Tangents
328+
) where {F}
329+
return DI.hvp!(f, tg, extras, SecondOrder(backend, backend), x, tx)
330+
end
331+
314332
## Hessian
315333

316334
### Unprepared

DifferentiationInterface/test/Back/ForwardDiff/test.jl

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -27,15 +27,12 @@ end
2727

2828
## Dense backends
2929

30-
test_differentiation(dense_backends, default_scenarios(); logging=LOGGING);
30+
test_differentiation(
31+
dense_backends, default_scenarios(; include_constantified=true); logging=LOGGING
32+
);
3133

3234
test_differentiation(
33-
dense_backends,
34-
default_scenarios(; include_constantified=true);
35-
correctness=false,
36-
type_stability=true,
37-
second_order=false,
38-
logging=LOGGING,
35+
dense_backends; correctness=false, type_stability=true, logging=LOGGING
3936
);
4037

4138
test_differentiation(

0 commit comments

Comments
 (0)