Skip to content

Add Cache as another type of context #551

Closed
Closed
@gdalle

Description

@gdalle

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    backendRelated to one or more autodiff backendscoreRelated to the core utilities of the package

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions