JuliaDiff / DifferentiationInterface.jl

An interface to various automatic differentiation backends in Julia.
https://juliadiff.org/DifferentiationInterface.jl/DifferentiationInterface
MIT License
188 stars 13 forks source link

Remove `stack`-based out-of-place Jacobian and Hessian? #533

Closed gdalle closed 4 weeks ago

gdalle commented 1 month ago

Currently, out-of-place Jacobians and Hessians use stack to put together the batches of JVPs/VJPs/HVPs, and there is a possible resizing at the end.

Is there any drawback to defining a buffer as jac = similar(x, length(y), length(x)) or hess = similar(x, length(x), length(x))?

The only one I see is that the operators would turn SArrays into MArrays

gdalle commented 4 weeks ago

Closing because it would impose mutability where I've made sure to avoid it