Open CasBex opened 11 months ago
I have been testing more about this issue.
I have the same error.
If we change the value of the initial condition to vcat(zeros(2), pguess)
the error is
ERROR: Mutating arrays is not supported -- called push!(Vector{Float64}, ...)
This error occurs when you ask Zygote to differentiate operations that change
the elements of arrays in place (e.g. setting values with x .= ...)
Possible fixes:
- avoid mutating operations (preferred)
- or read the documentation and solutions for this error
https://fluxml.ai/Zygote.jl/latest/limitations
Describe the bug 🐞
The cost function returned by
multiple_shooting_objective
is not differentiable by Zygote, which prevents using the AutoZygote AD setting in optimisation.Expected behavior Zygote succesfully computes the gradient of the cost function. The optimisation finishes succesfully.
Minimal Reproducible Example 👇
Error & Stacktrace ⚠️ The stacktrace was too long to paste here. Error is shown below
Environment (please complete the following information):
using Pkg; Pkg.status()
using Pkg; Pkg.status(; mode = PKGMODE_MANIFEST)
versioninfo()
Additional context
A little bit unrelated, but the model I'm trying to identify has 5 states and 38 parameters + 5*365=1825 parameters for starting points. Is it faster to use AutoZygote or AutoForwardDiff in this case? I'd think AutoForwardDiff is fast enough due to the small number of states but it seems slow and I have not been able to compare it with AutoZygote due to this bug.