Skip to content

Commit 71dd1ca

Browse files
fix: fix AD on default_consolidate
1 parent 229e8c2 commit 71dd1ca

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/systems/system.jl

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,9 @@ struct System <: AbstractSystem
107107
end
108108

109109
function default_consolidate(costs, subcosts)
110-
return sum(costs; init = 0.0) + sum(subcosts; init = 0.0)
110+
# `reduce` instead of `sum` because the rrule for `sum` doesn't
111+
# handle the `init` kwarg.
112+
return reduce(+, costs; init = 0.0) + reduce(+, subcosts; init = 0.0)
111113
end
112114

113115
function System(eqs::Vector{Equation}, iv, dvs, ps, brownians = [];

0 commit comments

Comments
 (0)