Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Cache as another type of context #551

Open
gdalle opened this issue Oct 8, 2024 · 1 comment
Open

Add Cache as another type of context #551

gdalle opened this issue Oct 8, 2024 · 1 comment
Labels
backend Related to one or more autodiff backends core Related to the core utilities of the package

Comments

@gdalle
Copy link
Member

gdalle commented Oct 8, 2024

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 Caches, 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
@gdalle gdalle added backend Related to one or more autodiff backends core Related to the core utilities of the package labels Oct 8, 2024
@gdalle
Copy link
Member Author

gdalle commented Oct 16, 2024

Implemented and tested for finite difference backends in #587

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backend Related to one or more autodiff backends core Related to the core utilities of the package
Projects
None yet
Development

No branches or pull requests

1 participant