Dynamically Create a Function - Initial Idea with eval failed due to World Age Issue

Try Base.invokelatest(Zygote.gradient, g, 10) instead. Zygote.gradient expects a function, you are passing it just the result of Base.invokelatest(g, 10) though.

4 Likes