When we add a UDE component to an existing ODESystem we automatically transform this into a DAE system because we add n algebraic equations for the neural network inputs. This means that we'll always have to use a DAE solver, such as the Rodas family to solve the resulting ODESystem.
When calling
ForwardDiff.gradient(Base.Fix2(of, ps), x0)
We get the following warning
┌ Warning: The supplied DiffCache was too small and was enlarged. This incurs allocations
│ on the first call to `get_tmp`. If few calls to `get_tmp` occur and optimal performance is essential,
│ consider changing 'N'/chunk size of this DiffCache to 12.
└ @ PreallocationTools ~/.julia/packages/PreallocationTools/zJxgA/src/PreallocationTools.jl:191
Describe the bug 🐞
When we add a UDE component to an existing
ODESystem
we automatically transform this into a DAE system because we add n algebraic equations for the neural network inputs. This means that we'll always have to use a DAE solver, such as the Rodas family to solve the resultingODESystem
.When calling
We get the following warning
This comes from the
_initialize_dae!
function in OrdinaryDiffEq, where a cache is created withI don't yet understand why we get this warning or how we can solve this.
Expected behavior
We should not have any warnings on the calls to gradients.
Minimal Reproducible Example 👇
See the tests.