I don’t want to pollute your new post and make people think that a solution has been found, so I’m posting here. I tried to run your code and I don’t see how to fix the bug, but at least you’re not alone
Do you have an idea why the ForwardDiff version works here but fails in Optimization.jl, DataInterpolations.jl and Gradients ?