I would like to compute the Hessian matrix of my Flux model.
I tried something like this without success:
n = 100 X = rand(2, n) Y = rand(1, n)
model = Chain(Dense(2,2),Dense(2,1)) loss(x,y) = Flux.mse(model(x),y) hess = Zygote.hessian(Flux.params(model)) do loss(X, Y) end
ERROR: MethodError: no method matching hessian(::var"#129#130", ::Params) Closest candidates are: hessian(::Any, ::AbstractArray) at /user/mpoliti/home/.julia/packages/Zygote/ggM8Z/src/lib/utils.jl:113 Stacktrace:  top-level scope at REPL:1