Skip to content

Commit

Permalink
Fix literal_getproperty for LinearSolution
Browse files Browse the repository at this point in the history
  • Loading branch information
avik-pal committed Feb 24, 2024
1 parent 1774538 commit 6beaa1e
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions ext/SciMLBaseZygoteExt.jl
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,15 @@ end
sol.u, solu_adjoint
end

@adjoint function literal_getproperty(sol::SciMLBase.LinearSolution, ::Val{:u})
function solu_adjoint(Δ)
zerou = zero(sol.u)
= @. ifelse=== nothing, zerou, Δ)
(SciMLBase.build_linear_solution(sol.cache.alg, _Δ, sol.resid, sol.cache),)

Check warning on line 174 in ext/SciMLBaseZygoteExt.jl

View check run for this annotation

Codecov / codecov/patch

ext/SciMLBaseZygoteExt.jl#L170-L174

Added lines #L170 - L174 were not covered by tests
end
sol.u, solu_adjoint

Check warning on line 176 in ext/SciMLBaseZygoteExt.jl

View check run for this annotation

Codecov / codecov/patch

ext/SciMLBaseZygoteExt.jl#L176

Added line #L176 was not covered by tests
end

@adjoint function literal_getproperty(sol::SciMLBase.OptimizationSolution,
::Val{:u})
function solu_adjoint(Δ)
Expand Down

0 comments on commit 6beaa1e

Please sign in to comment.