Skip to content

Commit 57bafc0

Browse files
committed
break ambig
1 parent a954672 commit 57bafc0

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

src/stage1/forward.jl

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -196,11 +196,13 @@ end
196196
# TODO: workout why enabling calling back into AD in Eras mode causes type instability
197197
_frule(::Val{true}, partials, primals...) = frule(partials, primals...)
198198
_frule(::Val{false}, partials, primals...) = frule(DiffractorRuleConfig(), partials, primals...)
199-
function _frule(::Any, ::NTuple{<:Any, AbstractZero}, f, primal_args...)
200-
# frules are linear in partials, so zero maps to zero, no need to evaluate the frule
201-
# If all partials are immutable AbstractZero subtyoes we know we don't have to worry about a mutating frule either
202-
r = f(primal_args...)
203-
return r, zero_tangent(r)
199+
for V in (false, true)
200+
@eval function _frule(::Val{$V}, ::NTuple{<:Any, AbstractZero}, f, primal_args...)
201+
# frules are linear in partials, so zero maps to zero, no need to evaluate the frule
202+
# If all partials are immutable AbstractZero subtyoes we know we don't have to worry about a mutating frule either
203+
r = f(primal_args...)
204+
return r, zero_tangent(r)
205+
end
204206
end
205207

206208
function ChainRulesCore.frule_via_ad(::DiffractorRuleConfig, partials, args...)

0 commit comments

Comments
 (0)