Skip to content

Commit

Permalink
Merge pull request #1059 from SciML/dg/defined
Browse files Browse the repository at this point in the history
Fence definition of `literal_getproperty` adjoint
  • Loading branch information
ChrisRackauckas authored May 26, 2024
2 parents 9226662 + cca0c2f commit 24b837f
Showing 1 changed file with 11 additions and 7 deletions.
18 changes: 11 additions & 7 deletions src/adjoint_common.jl
Original file line number Diff line number Diff line change
Expand Up @@ -652,12 +652,16 @@ function out_and_ts(_ts, duplicate_iterator_times, sol)
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, _Δ),)
if !hasmethod(Zygote.adjoint,
Tuple{Zygote.AContext, typeof(Zygote.literal_getproperty),
SciMLBase.AbstractTimeseriesSolution, Val{:u}})
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
sol.u, solu_adjoint
end

0 comments on commit 24b837f

Please sign in to comment.