Closed
Description
At the moment, DI only supports passing additional arguments if they are Constant
, that is, their value is not modified by the function.
We also need to support passing Cache
s, which can be mutated with active (differentiated) values.
Here's a breakdown of how this can work, backend by backend:
- Finite differences: straightforward, active values are just standard floats
- ForwardDiff: preallocate a corresponding cache with
Dual
numbers, similar to PreallocationTools.jl - Enzyme: mark the caches with
(Batch)Duplicated