Skip to content

Commit 7d99da1

Browse files
authored
Make Zygote extension depend on ForwardDiff too (#303)
1 parent 042d75f commit 7d99da1

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

DifferentiationInterface/Project.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ DifferentiationInterfaceReverseDiffExt = "ReverseDiff"
4141
DifferentiationInterfaceSymbolicsExt = "Symbolics"
4242
DifferentiationInterfaceTapirExt = "Tapir"
4343
DifferentiationInterfaceTrackerExt = "Tracker"
44-
DifferentiationInterfaceZygoteExt = "Zygote"
44+
DifferentiationInterfaceZygoteExt = ["Zygote", "ForwardDiff"]
4545

4646
[compat]
4747
ADTypes = "1.2.0"

DifferentiationInterface/ext/DifferentiationInterfaceZygoteExt/DifferentiationInterfaceZygoteExt.jl

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ using DifferentiationInterface:
1010
NoPullbackExtras,
1111
PullbackExtras
1212
using DocStringExtensions
13+
using ForwardDiff: ForwardDiff
1314
using Zygote:
1415
ZygoteRuleConfig, gradient, hessian, jacobian, pullback, withgradient, withjacobian
1516
using Compat
@@ -93,9 +94,9 @@ function DI.jacobian!(f, jac, backend::AutoZygote, x, extras::NoJacobianExtras)
9394
return copyto!(jac, DI.jacobian(f, backend, x, extras))
9495
end
9596

96-
## HVP (with ForwardDiff)
97+
## HVP
9798

98-
# TODO: find a way to do this without cheating?
99+
# Beware, this uses ForwardDiff for the inner differentiation
99100

100101
struct ZygoteHVPExtras{G,PE} <: HVPExtras
101102
∇f::G

0 commit comments

Comments
 (0)