EnzymeAD / Enzyme.jl

Julia bindings for the Enzyme automatic differentiator
https://enzyme.mit.edu
MIT License
422 stars 58 forks source link

API for Hessian #1495

Open gdalle opened 3 weeks ago

gdalle commented 3 weeks ago

A hessian / hessian! function in Enzyme would be cool!

Right now the method described in https://enzymead.github.io/Enzyme.jl/stable/generated/autodiff/#Forward-over-reverse uses BatchDuplicated. Am I correct in assuming that, like ForwardDiff's "chunks", Enzyme's "batches" are limited in size by memory bandwitch, typically to the order of 10 elements? If so, should there be a Hessian mode that computes HVPs in batches smaller than the size n?