Skip to content

Commit

Permalink
Merge pull request #1056 from SciML/dg/literal
Browse files Browse the repository at this point in the history
chore: move `literal_getproperty` adjoint to SciMLSensitivity
  • Loading branch information
ChrisRackauckas committed May 26, 2024
2 parents da44890 + ac2f59a commit dbb5917
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/SciMLSensitivity.jl
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,8 @@ import SciMLBase: unwrapped_f, _unwrap_val
import SciMLBase: AbstractOverloadingSensitivityAlgorithm, AbstractSensitivityAlgorithm,
AbstractForwardSensitivityAlgorithm, AbstractAdjointSensitivityAlgorithm,
AbstractSecondOrderSensitivityAlgorithm,
AbstractShadowingSensitivityAlgorithm
AbstractShadowingSensitivityAlgorithm,
AbstractTimeseriesSolution

include("parameters_handling.jl")
include("sensitivity_algorithms.jl")
Expand Down
10 changes: 10 additions & 0 deletions src/adjoint_common.jl
Original file line number Diff line number Diff line change
Expand Up @@ -651,3 +651,13 @@ function out_and_ts(_ts, duplicate_iterator_times, sol)
end
return out, ts
end

Zygote.@adjoint function Zygote.literal_getproperty(sol::AbstractTimeseriesSolution,
::Val{:u})
function solu_adjoint(Δ)
zerou = zero(sol.prob.u0)
= @. ifelse=== nothing, (zerou,), Δ)
(SciMLBase.build_solution(sol.prob, sol.alg, sol.t, _Δ),)
end
sol.u, solu_adjoint
end

0 comments on commit dbb5917

Please sign in to comment.