I’m trying to learn how to use autodifferentiation for the first time since that came up in something else. What am I doing wrong?
using ForwardDiff f(x) = 2x g = x -> ForwardDiff.gradient(f, x) g(2) # DimensionMismatch("gradient(f, x) expects that x is an array. Perhaps you meant derivative(f, x)?")
Why does this give a dimension mismatch error? Thanks