Skip to content

Commit 84ee3db

Browse files
authored
add rrule for ODE and SDEProblem constructors (#800)
1 parent 78e16ff commit 84ee3db

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

src/chainrules.jl

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,19 @@
1+
function ChainRulesCore.rrule(::Type{ODEProblem}, args...; kwargs...)
2+
function ODEProblemAdjoint(ȳ)
3+
(NoTangent(), ȳ.f, ȳ.u0, ȳ.tspan, ȳ.p, ȳ.kwargs, ȳ.problem_type)
4+
end
5+
6+
ODEProblem(args...; kwargs...), ODEProblemAdjoint
7+
end
8+
9+
function ChainRulesCore.rrule(::Type{SDEProblem}, args...; kwargs...)
10+
function SDEProblemAdjoint(ȳ)
11+
(NoTangent(), ȳ.f, ȳ.g, ȳ.u0, ȳ.tspan, ȳ.p, ȳ.kwargs, ȳ.problem_type)
12+
end
13+
14+
SDEProblem(args...; kwargs...), SDEProblemAdjoint
15+
end
16+
117
function ChainRulesCore.rrule(::Type{
218
<:ODESolution{T1, T2, T3, T4, T5, T6, T7, T8, T9, T10,
319
T11

0 commit comments

Comments
 (0)