Skip to content

Commit edb41a5

Browse files
committed
Fix frule definitions
1 parent de800db commit edb41a5

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

src/Blocks/sources.jl

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -590,7 +590,13 @@ function Symbolics.derivative(::typeof(get_sampled_data), args::NTuple{2, Any},
590590
first_order_backwards_difference(t, memory)
591591
end
592592
function ChainRulesCore.frule((_, ẋ, _), ::typeof(get_sampled_data), t, memory)
593-
first_order_backwards_difference(t, memory) *
593+
get_sampled_data(t, memory), first_order_backwards_difference(t, memory) *
594+
end
595+
function ChainRulesCore.frule((_, ẋ, _),
596+
::typeof(first_order_backwards_difference),
597+
t,
598+
memory)
599+
first_order_backwards_difference(t, memory), 0
594600
end
595601

596602
"""
@@ -675,6 +681,7 @@ function ChainRulesCore.frule((_, _, ṫ, ẋ, _),
675681
t,
676682
x,
677683
Δt)
684+
set_sampled_data!(memory, t, x, Δt),
678685
first_order_backwards_difference(t, x, Δt, memory) *+
679686
end
680687

0 commit comments

Comments
 (0)