Skip to content

Commit 594d720

Browse files
committed
Last fix
1 parent 534f981 commit 594d720

4 files changed

Lines changed: 4 additions & 6 deletions

File tree

DifferentiationInterface/ext/DifferentiationInterfaceChainRulesCoreExt/differentiate_with.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
function ChainRulesCore.rrule(dw::DI.DifferentiateWith, x)
22
(; f, backend) = dw
33
y = f(x)
4-
prep_same = DI.prepare_pullback_same_point(f, backend, x, (y,); strict=Val(true))
4+
prep_same = DI.prepare_pullback_same_point(Val(true), f, backend, x, (y,))
55
function pullbackfunc(dy)
66
tx = DI.pullback(f, prep_same, backend, x, (dy,))
77
return (NoTangent(), only(tx))

DifferentiationInterface/ext/DifferentiationInterfaceChainRulesCoreExt/reverse_onearg.jl

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ function DI.prepare_pullback(
1919
end
2020

2121
function DI.prepare_pullback_same_point(
22-
strict,
2322
f,
2423
prep::DI.NoPullbackPrep,
2524
backend::AutoReverseChainRules,
@@ -28,7 +27,7 @@ function DI.prepare_pullback_same_point(
2827
contexts::Vararg{DI.GeneralizedConstant,C};
2928
) where {C}
3029
DI.check_prep(f, prep, backend, x, ty, contexts...)
31-
_sig = DI.signature(f, backend, x, ty, contexts...; strict)
30+
_sig = DI.signature(f, backend, x, ty, contexts...; strict=DI.is_strict(prep))
3231
rc = ruleconfig(backend)
3332
y, pb = rrule_via_ad(rc, f, x, map(DI.unwrap, contexts)...)
3433
return ChainRulesPullbackPrepSamePoint(_sig, y, pb)

DifferentiationInterface/ext/DifferentiationInterfaceTrackerExt/DifferentiationInterfaceTrackerExt.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,8 @@ function DI.prepare_pullback_same_point(
3535
ty::NTuple,
3636
contexts::Vararg{DI.GeneralizedConstant,C},
3737
) where {C}
38-
_sig = DI.signature(f, backend, x, ty, contexts...; strict=DI.is_strict(prep))
3938
DI.check_prep(f, prep, backend, x, ty, contexts...)
39+
_sig = DI.signature(f, backend, x, ty, contexts...; strict=DI.is_strict(prep))
4040
y, pb = forward(f, x, map(DI.unwrap, contexts)...)
4141
return TrackerPullbackPrepSamePoint(_sig, y, pb)
4242
end

DifferentiationInterface/src/docstrings.jl

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,15 +19,14 @@ function docstring_prepare(operator; samepoint=false, inplace=false)
1919
Create a `prep` object that can be given to [`$(operator)`](@ref) and its variants to speed them up$(samepoint_warning(samepoint)).
2020
2121
Depending on the backend, this can have several effects (preallocating memory, recording an execution trace) which are transparent to the user.
22+
$(inplace ? "\nFor in-place functions, `y` is mutated by `f!` during preparation." : "")
2223
2324
!!! warning
2425
The preparation result `prep` is only reusable as long as the arguments to `$operator` do not change type or size, and the function and backend themselves are not modified.
2526
Otherwise, preparation becomes invalid and you need to run it again.
2627
In some settings, invalid preparations may still give correct results (e.g. for backends that require no preparation), but this is not a semantic guarantee and should not be relied upon.
2728
2829
When `strict=Val(true)`, type checking is enforced between preparation and execution (but size checking is left to the user).
29-
30-
$(inplace ? "\nFor in-place functions, `y` is mutated by `f!` during preparation." : "")
3130
"""
3231
end
3332

0 commit comments

Comments
 (0)