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

Cache support with ForwardDiff #590

Merged
merged 2 commits into from
Oct 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion DifferentiationInterface/Project.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name = "DifferentiationInterface"
uuid = "a0c0ee7d-e4b9-4e03-894e-1c5f64a51d63"
authors = ["Guillaume Dalle", "Adrian Hill"]
version = "0.6.15"
version = "0.6.16"

[deps]
ADTypes = "47edcb42-4c32-4615-8424-f2b9edc5f35b"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ Right now, there are two kinds of context: [`Constant`](@ref) and [`Cache`](@ref
This feature is still experimental and will not be supported by all backends.
At the moment:
- `Constant` is supported by all backends except symbolic ones
- `Cache` is only supported by finite difference backends
- `Cache` is only supported by finite difference backends and [`AutoForwardDiff`](@ref), but it is not yet optimized

Semantically, both of these calls compute the partial gradient of `f(x, c)` with respect to `x`, but they consider `c` differently:

Expand Down
2 changes: 2 additions & 0 deletions DifferentiationInterface/docs/src/tutorials/advanced.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,8 @@ prep_other_constant = prepare_gradient(f_multiarg, backend, x, Constant(-1))
gradient(f_multiarg, prep_other_constant, backend, x, Constant(10))
```

For additional arguments which act as mutated buffers, the [`Cache`](@ref) wrapper is the appropriate choice instead of [`Constant`](@ref).

## Sparsity

Sparse AD is very useful when Jacobian or Hessian matrices have a lot of zeros.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ using Base: Fix1, Fix2
import DifferentiationInterface as DI
using DifferentiationInterface:
BatchSizeSettings,
Cache,
Constant,
Context,
DerivativePrep,
DifferentiateWith,
Expand Down
Loading
Loading