You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
You can use [`check_available`](@ref) to verify whether a given backend is loaded.
98
-
99
-
### Support for two-argument functions
100
-
101
-
All backends are compatible with one-argument functions `f(x) = y`.
102
-
Only some are compatible with two-argument functions `f!(y, x) = nothing`.
103
-
You can use [`check_twoarg`](@ref) to verify this compatibility.
104
-
105
-
### Support for Hessian
106
-
107
-
Only some backends are able to compute Hessians.
108
-
You can use [`check_hessian`](@ref) to verify this feature (beware that it will try to compute a small Hessian, so it is not instantaneous like the other checks).
109
-
110
102
## Backend switch
111
103
112
104
The wrapper [`DifferentiateWith`](@ref) allows you to switch between backends.
Copy file name to clipboardExpand all lines: DifferentiationInterface/docs/src/dev_guide.md
+3-5Lines changed: 3 additions & 5 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -24,8 +24,7 @@ Most operators have 4 variants, which look like this in the first order: `operat
24
24
## New operator
25
25
26
26
To implement a new operator for an existing backend, you need to write 5 methods: 1 for [preparation](@ref Preparation) and 4 corresponding to the variants of the operator (see above).
27
-
In some cases, a subset of those methods will be enough, but most of the time, forgetting one will trigger errors.
28
-
For first-order operators, you may also want to support [two-argument functions](@ref"Mutation and signatures"), which requires another 5 methods (defined on `f!` instead of `f`).
27
+
For first-order operators, you may also want to support [in-place functions](@ref"Mutation and signatures"), which requires another 5 methods (defined on `f!` instead of `f`).
29
28
30
29
The method `prepare_operator` must output an `extras` object of the correct type.
31
30
For instance, `prepare_gradient(f, backend, x)` must return a [`DifferentiationInterface.GradientExtras`](@ref).
@@ -40,7 +39,7 @@ Your AD package needs to be registered first.
40
39
### Core code
41
40
42
41
In the main package, you should define a new struct `SuperDiffBackend` which subtypes [`ADTypes.AbstractADType`](@extref ADTypes), and endow it with the fields you need to parametrize your differentiation routines.
43
-
You also have to define [`ADTypes.mode`](@extref) and [`DifferentiationInterface.twoarg_support`](@ref) on `SuperDiffBackend`.
42
+
You also have to define [`ADTypes.mode`](@extref) and [`DifferentiationInterface.inplace_support`](@ref) on `SuperDiffBackend`.
44
43
45
44
!!! info
46
45
In the end, this backend struct will need to be contributed to [ADTypes.jl](https://github.com/SciML/ADTypes.jl).
@@ -79,5 +78,4 @@ GROUP = get(ENV, "JULIA_DI_TEST_GROUP", "Back/SuperDiff")
79
78
80
79
but don't forget to switch it back before pushing.
81
80
82
-
Finally, you need to add your backend to the documentation, modifying every page that involves a list of backends.
83
-
That includes the README.
81
+
Finally, you need to add your backend to the documentation, modifying every page that involves a list of backends (including the `README.md`).
Copy file name to clipboardExpand all lines: DifferentiationInterface/docs/src/implementations.md
+6-10Lines changed: 6 additions & 10 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,10 +1,6 @@
1
1
# Implementations
2
2
3
-
DifferentiationInterface.jl provides a handful of [operators](@ref"Operators") like [`gradient`](@ref) or [`jacobian`](@ref), each with several variants:
4
-
5
-
-**out-of-place** or **in-place** behavior
6
-
-**with** or **without primal** output value
7
-
- support for **one-argument functions**`y = f(x)` or **two-argument functions**`f!(y, x)`
3
+
DifferentiationInterface.jl provides a handful of [operators](@ref"Operators") like [`gradient`](@ref) or [`jacobian`](@ref), each with several variants: out-of-place or in-place behavior, with or without primal output value.
8
4
9
5
While it is possible to define every operator using just [`pushforward`](@ref) and [`pullback`](@ref), some backends have more efficient implementations of high-level operators.
10
6
When they are available, we nearly always call these backend-specific overloads.
@@ -24,7 +20,7 @@ The cells can have three values:
24
20
```@setup overloads
25
21
using ADTypes: AbstractADType
26
22
using DifferentiationInterface
27
-
using DifferentiationInterface: twoarg_support, TwoArgSupported
23
+
using DifferentiationInterface: inplace_support, InPlaceSupported
28
24
using Markdown: Markdown
29
25
30
26
using Diffractor: Diffractor
@@ -152,16 +148,16 @@ function print_overloads(backend, ext::Symbol)
0 commit comments