Skip to content

Commit dbdc8bf

Browse files
Revert "Fix ordering of the promotion [Take II]"
1 parent 13ac2da commit dbdc8bf

File tree

2 files changed

+8
-14
lines changed

2 files changed

+8
-14
lines changed

ext/DiffEqBaseTrackerExt.jl

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -97,15 +97,9 @@ Tracker.@grad function DiffEqBase.solve_up(prob,
9797
},
9898
u0, p, args...;
9999
kwargs...)
100-
sol, pb_f = DiffEqBase._solve_adjoint(
101-
prob, sensealg, Tracker.data(u0), Tracker.data(p),
100+
out = DiffEqBase._solve_adjoint(prob, sensealg, Tracker.data(u0), Tracker.data(p),
102101
SciMLBase.TrackerOriginator(), args...; kwargs...)
103-
104-
if sol isa AbstractArray
105-
!hasfield(typeof(sol), :u) && return sol, pb_f # being safe here
106-
return sol.u, pb_f # AbstractNoTimeSolution isa AbstractArray
107-
end
108-
return convert(AbstractArray, sol), pb_f
102+
Array(out[1]), out[2]
109103
end
110104

111105
end

src/solve.jl

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1130,23 +1130,23 @@ function get_concrete_problem(prob::AbstractJumpProblem, isadapt; kwargs...)
11301130
end
11311131

11321132
function get_concrete_problem(prob::SteadyStateProblem, isadapt; kwargs...)
1133-
p = get_concrete_p(prob, kwargs)
11341133
u0 = get_concrete_u0(prob, isadapt, Inf, kwargs)
1135-
u0 = promote_u0(u0, p, nothing)
1134+
u0 = promote_u0(u0, prob.p, nothing)
1135+
p = get_concrete_p(prob, kwargs)
11361136
remake(prob; u0 = u0, p = p)
11371137
end
11381138

11391139
function get_concrete_problem(prob::NonlinearProblem, isadapt; kwargs...)
1140-
p = get_concrete_p(prob, kwargs)
11411140
u0 = get_concrete_u0(prob, isadapt, nothing, kwargs)
1142-
u0 = promote_u0(u0, p, nothing)
1141+
u0 = promote_u0(u0, prob.p, nothing)
1142+
p = get_concrete_p(prob, kwargs)
11431143
remake(prob; u0 = u0, p = p)
11441144
end
11451145

11461146
function get_concrete_problem(prob::NonlinearLeastSquaresProblem, isadapt; kwargs...)
1147-
p = get_concrete_p(prob, kwargs)
11481147
u0 = get_concrete_u0(prob, isadapt, nothing, kwargs)
1149-
u0 = promote_u0(u0, p, nothing)
1148+
u0 = promote_u0(u0, prob.p, nothing)
1149+
p = get_concrete_p(prob, kwargs)
11501150
remake(prob; u0 = u0, p = p)
11511151
end
11521152

0 commit comments

Comments
 (0)