Skip to content

Fix use of remake_zero! with callback affect differentiation #1223

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 1 addition & 8 deletions src/derivative_wrappers.jl
Original file line number Diff line number Diff line change
Expand Up @@ -720,14 +720,7 @@ function _vecjacobian!(dλ, y, λ, p, t, S::TS, isautojacvec::EnzymeVJP, dgrad,
isautojacvec = get_jacvec(sensealg)

if inplace_sensitivity(S)
if S isa CallbackSensitivityFunction
# Correctness over speed
# TODO: Get a fix for `remake_zero!` to allow reusing zero'd memory
# https://github.com/EnzymeAD/Enzyme.jl/issues/2400
_tmp6 = Enzyme.make_zero(SciMLBase.Void(f))
else
Enzyme.remake_zero!(_tmp6)
end
Enzyme.remake_zero!(_tmp6)

if W === nothing
Enzyme.autodiff(Enzyme.Reverse, Enzyme.Duplicated(SciMLBase.Void(f), _tmp6),
Expand Down
Loading