Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow BackSolveAdjoint to accept MTKParameters #1131

Draft
wants to merge 3 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 0 additions & 5 deletions src/concrete_solve.jl
Original file line number Diff line number Diff line change
Expand Up @@ -372,11 +372,6 @@ function DiffEqBase._concrete_solve_adjoint(
saveat = eltype(prob.tspan)[],
save_idxs = nothing,
kwargs...)
if !(sensealg isa GaussAdjoint) &&
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If lifting this, then InterpolatingAdjoint and QuadartureAdjoint should also be tested.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agreed, that's why I have marked this draft, so I can test, and if necessary add the check back with allowing BacksolveAdjoint through 😅

!(p isa Union{Nothing, SciMLBase.NullParameters, AbstractArray}) ||
(p isa AbstractArray && !Base.isconcretetype(eltype(p)))
throw(AdjointSensitivityParameterCompatibilityError())
end

if p === nothing || p isa SciMLBase.NullParameters
tunables, repack = p, identity
Expand Down
1 change: 1 addition & 0 deletions src/parameters_handling.jl
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
recursive_copyto!(y::AbstractArray, x::AbstractArray) = copyto!(y, x)
recursive_copyto!(y::AbstractArray, x::Number) = y .= x
recursive_copyto!(y::Tuple, x::Tuple) = map(recursive_copyto!, y, x)
recursive_copyto!(y::AbstractArray, x::Tuple) = recursive_copyto!(y, only(x))
function recursive_copyto!(y::NamedTuple{F}, x::NamedTuple{F}) where {F}
map(recursive_copyto!, values(y), values(x))
end
Expand Down
5 changes: 1 addition & 4 deletions src/sensitivity_interface.jl
Original file line number Diff line number Diff line change
Expand Up @@ -413,10 +413,7 @@ function _adjoint_sensitivities(sol, sensealg, alg;
callback = nothing,
kwargs...)
mtkp = SymbolicIndexingInterface.parameter_values(sol)
if !(mtkp isa Union{Nothing, SciMLBase.NullParameters, AbstractArray}) ||
(mtkp isa AbstractArray && !Base.isconcretetype(eltype(mtkp)))
throw(AdjointSensitivityParameterCompatibilityError())
end

rcb = nothing
if sol.prob isa ODEProblem
adj_prob, rcb = ODEAdjointProblem(sol, sensealg, alg, t, dgdu_discrete,
Expand Down
Loading