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
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.