Skip to content

Commit fac64b7

Browse files
authored
Reexport backends from ADTypes (#217)
* Reexport ADTypes * Remove ADTypes namespacing when possible * Include reexported ADTypes in API reference * Minor fixes * Move backend API reference to "Backends" page
1 parent 32b70a2 commit fac64b7

6 files changed

Lines changed: 50 additions & 7 deletions

File tree

DifferentiationInterface/docs/make.jl

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import DifferentiationInterface as DI
44
using Documenter
55
using DocumenterMermaid
66

7-
using ADTypes
7+
using ADTypes: ADTypes
88
using Diffractor: Diffractor
99
using Enzyme: Enzyme
1010
using FastDifferentiation: FastDifferentiation
@@ -37,16 +37,18 @@ extensions = [
3737
]
3838

3939
makedocs(;
40-
modules=[DifferentiationInterface, extensions...],
40+
modules=[DifferentiationInterface, ADTypes, extensions...],
4141
authors="Guillaume Dalle, Adrian Hill",
4242
sitename="DifferentiationInterface.jl",
4343
format=Documenter.HTML(),
4444
pages=[
45-
"Home" => "index.md", #
45+
"Home" => "index.md",
4646
"Start here" => ["tutorial.md", "overview.md", "backends.md"],
4747
"API reference" => "api.md",
4848
"Advanced" => ["design.md", "extensions.md", "overloads.md"],
4949
],
50+
checkdocs=:exports,
51+
warnonly=[:missing_docs, :cross_references],
5052
)
5153

5254
deploydocs(;

DifferentiationInterface/docs/src/backends.md

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ CollapsedDocStrings = true
44
```
55

66
```@setup backends
7-
using ADTypes
87
using DifferentiationInterface
98
using DifferentiationInterface: backend_string
109
import Markdown
@@ -70,3 +69,27 @@ You can check this compatibility using [`check_twoarg`](@ref).
7069

7170
Only some backends are able to compute Hessians.
7271
You can use [`check_hessian`](@ref) to check this feature.
72+
73+
74+
## API Reference
75+
76+
!!! warning
77+
The following documentation has been re-exported from [ADTypes.jl](https://github.com/SciML/ADTypes.jl).
78+
Refer to the ADTypes documentation for more information.
79+
80+
```@docs
81+
AutoChainRules
82+
AutoDiffractor
83+
AutoEnzyme
84+
AutoFastDifferentiation
85+
AutoFiniteDiff
86+
AutoFiniteDifferences
87+
AutoForwardDiff
88+
AutoPolyesterForwardDiff
89+
AutoReverseDiff
90+
AutoSymbolics
91+
AutoTapir
92+
AutoTracker
93+
AutoZygote
94+
AutoSparse
95+
```

DifferentiationInterface/docs/src/overloads.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ Each cell can have three values:
2222
Check marks (✅) are clickable and link to the source code.
2323

2424
```@setup overloads
25-
using ADTypes
25+
using ADTypes: AbstractADType
2626
using DifferentiationInterface
2727
using DifferentiationInterface: backend_string, mutation_support, MutationSupported
2828
using Markdown: Markdown

DifferentiationInterface/src/DifferentiationInterface.jl

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,4 +87,21 @@ export prepare_second_derivative, prepare_hvp, prepare_hessian
8787

8888
export check_available, check_twoarg, check_hessian
8989

90+
# Re-export backends from ADTypes
91+
export AutoChainRules
92+
export AutoDiffractor
93+
export AutoEnzyme
94+
export AutoFastDifferentiation
95+
export AutoFiniteDiff
96+
export AutoFiniteDifferences
97+
export AutoForwardDiff
98+
export AutoPolyesterForwardDiff
99+
export AutoReverseDiff
100+
export AutoSymbolics
101+
export AutoTapir
102+
export AutoTracker
103+
export AutoZygote
104+
105+
export AutoSparse
106+
90107
end # module

DifferentiationInterface/src/utils/printing.jl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
backend_package_name(b::AbstractADType) = strip(string(b), ['(', ')'])
2+
backend_package_name(b::AutoSparse) = backend_package_name(dense_ad(b))
23

34
backend_package_name(::AutoChainRules) = "ChainRules"
45
backend_package_name(::AutoDiffractor) = "Diffractor"

DifferentiationInterfaceTest/docs/src/tutorial.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ We present a typical workflow with DifferentiationInterfaceTest.jl, building on
88

99
```@repl tuto
1010
using DifferentiationInterface, DifferentiationInterfaceTest
11-
import ADTypes, ForwardDiff, Enzyme
11+
import ForwardDiff, Enzyme
1212
import DataFrames, Markdown, PrettyTables, Printf
1313
```
1414

@@ -17,7 +17,7 @@ import DataFrames, Markdown, PrettyTables, Printf
1717
The AD backends we want to compare are [ForwardDiff.jl](https://github.com/JuliaDiff/ForwardDiff.jl) and [Enzyme.jl](https://github.com/EnzymeAD/Enzyme.jl).
1818

1919
```@repl tuto
20-
backends = [ADTypes.AutoForwardDiff(), ADTypes.AutoEnzyme(; mode=Enzyme.Reverse)]
20+
backends = [AutoForwardDiff(), AutoEnzyme(; mode=Enzyme.Reverse)]
2121
```
2222

2323
To do that, we are going to take gradients of a simple function:

0 commit comments

Comments
 (0)