Skip to content

Commit

Permalink
use Enzyme make_zero
Browse files Browse the repository at this point in the history
  • Loading branch information
m-bossart committed Jun 6, 2024
1 parent beeb5e4 commit e036d21
Showing 1 changed file with 2 additions and 7 deletions.
9 changes: 2 additions & 7 deletions ext/DiffEqBaseEnzymeExt.jl
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,7 @@ function Enzyme.EnzymeRules.augmented_primal(config::Enzyme.EnzymeRules.ConfigWi
SciMLBase.EnzymeOriginator(), ntuple(arg_copy, Val(length(args)))...;
kwargs...)

dres = deepcopy(res[1])::RT
for v in dres.u
v .= 0
end
dres = Enzyme.make_zero(res[1])::RT

Check warning on line 31 in ext/DiffEqBaseEnzymeExt.jl

View check run for this annotation

Codecov / codecov/patch

ext/DiffEqBaseEnzymeExt.jl#L31

Added line #L31 was not covered by tests
tup = (dres, res[2])
return Enzyme.EnzymeRules.AugmentedReturn{RT, RT, Any}(res[1], dres, tup::Any)
end
Expand All @@ -52,9 +49,7 @@ function Enzyme.EnzymeRules.reverse(config::Enzyme.EnzymeRules.ConfigWidth{1},
end
ptr.dval .+= darg
end
for v in dres.u
v .= 0
end
dres = Enzyme.make_zero(dres)

Check warning on line 52 in ext/DiffEqBaseEnzymeExt.jl

View check run for this annotation

Codecov / codecov/patch

ext/DiffEqBaseEnzymeExt.jl#L52

Added line #L52 was not covered by tests
return ntuple(_ -> nothing, Val(length(args) + 4))
end

Expand Down

0 comments on commit e036d21

Please sign in to comment.