See @stevengj’s implementation at FAQ suggestion: lazily allocate buffers for use with automatic differentiation · Issue #769 · SciML/DifferentialEquations.jl · GitHub, and see the diffcache discussion at ForwardDiff caches usage . Once JuliaCon videos are done I think it would be good to spawn out a package around this.
2 Likes