You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I wish to use Flux.training to optimize a parameter in parallel ensemble simulation defined by EnsembleProblem() provided by DifferentialEquations.jl. The output I expect is the gradient output with respect to the tracked parameter. However, it shows that there's no adjoint method provided as below:
ERROR: LoadError: Need an adjoint for constructor EnsembleSolution{Float64,2,Array{ODESolution{Float64,1,Array{Float64,1},Nothing,Nothing,Array{Float64,1},Array{Array{Float64,1},1},ODEProblem{Float64,Tuple{Float64,Float64},false,DiffEqBase.NullParameters,ODEFunction{false,var"#16#17",LinearAlgebra.UniformScaling{Bool},Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing},Base.Iterators.Pairs{Symbol,QuadratureAdjoint{0,true,Val{:central},Bool},Tuple{Symbol},NamedTuple{(:sensealg,),Tuple{QuadratureAdjoint{0,true,Val{:central},Bool}}}},DiffEqBase.StandardODEProblem},Tsit5,OrdinaryDiffEq.InterpolationData{ODEFunction{false,var"#16#17",LinearAlgebra.UniformScaling{Bool},Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing},Array{Float64,1},Array{Float64,1},Array{Array{Float64,1},1},OrdinaryDiffEq.Tsit5ConstantCache{Float64,Float64}},DiffEqBase.DEStats},1}}. Gradient is of type Array{Float64,2}
My simplified code is attached as below. I'd be grateful of any insights.
using DifferentialEquations, Flux, DiffEqSensitivity
pa = [1.0]
function model1(input)
prob = ODEProblem((u, p, t) -> 1.01u * pa[1], 0.5, (0.0, 1.0), sensealg = QuadratureAdjoint())
function prob_func(prob, i, repeat)
remake(prob, u0 = rand() * prob.u0)
end
ensemble_prob = EnsembleProblem(prob, prob_func = prob_func)
sim = solve(ensemble_prob, Tsit5(), EnsembleThreads(), trajectories = 100)
end
Input_time_series = zeros(5, 100)
loss(x, y) = Flux.mse(model1(x), y)
data = Iterators.repeated((Input_time_series, 0), 1)
gs = Flux.gradient(() -> loss(Input_time_series, 0), params(pa))
The text was updated successfully, but these errors were encountered:
I wish to use Flux.training to optimize a parameter in parallel ensemble simulation defined by EnsembleProblem() provided by DifferentialEquations.jl. The output I expect is the gradient output with respect to the tracked parameter. However, it shows that there's no adjoint method provided as below:
My simplified code is attached as below. I'd be grateful of any insights.
The text was updated successfully, but these errors were encountered: