Skip to content

Commit d749b5a

Browse files
Merge pull request #54 from adrhill/ah/docs
Improve backend type docstrings
2 parents cb4eb36 + 9b98c86 commit d749b5a

File tree

1 file changed

+53
-81
lines changed

1 file changed

+53
-81
lines changed

src/dense.jl

Lines changed: 53 additions & 81 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,13 @@
11
"""
2-
AutoChainRules{RC}
3-
4-
Chooses any AD library based on [ChainRulesCore.jl](https://github.com/JuliaDiff/ChainRulesCore.jl) (see the list [here](https://juliadiff.org/ChainRulesCore.jl/stable/index.html#ChainRules-roll-out-status)).
2+
AutoChainRules(; ruleconfig)
53
6-
# Fields
4+
Struct used to select an automatic differentiation backend based on [ChainRulesCore.jl](https://github.com/JuliaDiff/ChainRulesCore.jl) (see the list [here](https://juliadiff.org/ChainRulesCore.jl/stable/index.html#ChainRules-roll-out-status)).
75
8-
- `ruleconfig::RC`: a [`ChainRulesCore.RuleConfig`](https://juliadiff.org/ChainRulesCore.jl/stable/rule_author/superpowers/ruleconfig.html) object.
6+
Exported from [ADTypes.jl](https://github.com/SciML/ADTypes.jl).
97
10-
# Constructor
8+
# Keyword Arguments
119
12-
AutoChainRules(; ruleconfig)
10+
- `ruleconfig::RC`: a [`ChainRulesCore.RuleConfig`](https://juliadiff.org/ChainRulesCore.jl/stable/rule_author/superpowers/ruleconfig.html) object.
1311
"""
1412
Base.@kwdef struct AutoChainRules{RC} <: AbstractADType
1513
ruleconfig::RC
@@ -18,32 +16,28 @@ end
1816
mode(::AutoChainRules) = ForwardOrReverseMode() # specialized in the extension
1917

2018
"""
21-
AutoDiffractor
22-
23-
Chooses [Diffractor.jl](https://github.com/JuliaDiff/Diffractor.jl).
19+
AutoDiffractor()
2420
25-
# Constructor
21+
Struct used to select the [Diffractor.jl](https://github.com/JuliaDiff/Diffractor.jl) backend for automatic differentiation.
2622
27-
AutoDiffractor()
23+
Exported from [ADTypes.jl](https://github.com/SciML/ADTypes.jl).
2824
"""
2925
struct AutoDiffractor <: AbstractADType end
3026

3127
mode(::AutoDiffractor) = ForwardOrReverseMode()
3228

3329
"""
34-
AutoEnzyme{M}
30+
AutoEnzyme(; mode=nothing)
31+
32+
Struct used to select the [Enzyme.jl](https://github.com/EnzymeAD/Enzyme.jl) backend for automatic differentiation.
3533
36-
Chooses [Enzyme.jl](https://github.com/EnzymeAD/Enzyme.jl).
34+
Exported from [ADTypes.jl](https://github.com/SciML/ADTypes.jl).
3735
38-
# Fields
36+
# Keyword Arguments
3937
4038
- `mode::M`: can be either
4139
- an object subtyping `EnzymeCore.Mode` (like `EnzymeCore.Forward` or `EnzymeCore.Reverse`) if a specific mode is required
4240
- `nothing` to choose the best mode automatically
43-
44-
# Constructors
45-
46-
AutoEnzyme(; mode=nothing)
4741
"""
4842
Base.@kwdef struct AutoEnzyme{M} <: AbstractADType
4943
mode::M = nothing
@@ -52,32 +46,28 @@ end
5246
mode(::AutoEnzyme) = ForwardOrReverseMode() # specialized in the extension
5347

5448
"""
55-
AutoFastDifferentiation
56-
57-
Chooses [FastDifferentiation.jl](https://github.com/brianguenter/FastDifferentiation.jl).
49+
AutoFastDifferentiation()
5850
59-
# Constructor
51+
Struct used to select the [FastDifferentiation.jl](https://github.com/brianguenter/FastDifferentiation.jl) backend for automatic differentiation.
6052
61-
AutoFastDifferentiation()
53+
Exported from [ADTypes.jl](https://github.com/SciML/ADTypes.jl).
6254
"""
6355
struct AutoFastDifferentiation <: AbstractADType end
6456

6557
mode(::AutoFastDifferentiation) = SymbolicMode()
6658

6759
"""
68-
AutoFiniteDiff{T1,T2,T3}
60+
AutoFiniteDiff(; fdtype=Val(:forward), fdjtype=fdtype, fdhtype=Val(:hcentral))
6961
70-
Chooses [FiniteDiff.jl](https://github.com/JuliaDiff/FiniteDiff.jl).
62+
Struct used to select the [FiniteDiff.jl](https://github.com/JuliaDiff/FiniteDiff.jl) backend for automatic differentiation.
7163
72-
# Fields
64+
Exported from [ADTypes.jl](https://github.com/SciML/ADTypes.jl).
65+
66+
# Keyword Arguments
7367
7468
- `fdtype::T1`: finite difference type
7569
- `fdjtype::T2`: finite difference type for the Jacobian
7670
- `fdhtype::T3`: finite difference type for the Hessian
77-
78-
# Constructor
79-
80-
AutoFiniteDiff(; fdtype=Val(:forward), fdjtype=fdtype, fdhtype=Val(:hcentral))
8171
"""
8272
Base.@kwdef struct AutoFiniteDiff{T1, T2, T3} <: AbstractADType
8373
fdtype::T1 = Val(:forward)
@@ -88,17 +78,15 @@ end
8878
mode(::AutoFiniteDiff) = ForwardMode()
8979

9080
"""
91-
AutoFiniteDifferences{T}
92-
93-
Chooses [FiniteDifferences.jl](https://github.com/JuliaDiff/FiniteDifferences.jl).
81+
AutoFiniteDifferences(; fdm)
9482
95-
# Fields
83+
Struct used to select the [FiniteDifferences.jl](https://github.com/JuliaDiff/FiniteDifferences.jl) backend for automatic differentiation.
9684
97-
- `fdm::T`: a [`FiniteDifferenceMethod`](https://juliadiff.org/FiniteDifferences.jl/stable/pages/api/#FiniteDifferences.FiniteDifferenceMethod)
85+
Exported from [ADTypes.jl](https://github.com/SciML/ADTypes.jl).
9886
99-
# Constructor
87+
# Keyword Arguments
10088
101-
AutoFiniteDifferences(; fdm)
89+
- `fdm::T`: a [`FiniteDifferenceMethod`](https://juliadiff.org/FiniteDifferences.jl/stable/pages/api/#FiniteDifferences.FiniteDifferenceMethod)
10290
"""
10391
Base.@kwdef struct AutoFiniteDifferences{T} <: AbstractADType
10492
fdm::T
@@ -107,21 +95,16 @@ end
10795
mode(::AutoFiniteDifferences) = ForwardMode()
10896

10997
"""
110-
AutoForwardDiff{chunksize,T}
111-
112-
Chooses [ForwardDiff.jl](https://github.com/JuliaDiff/ForwardDiff.jl).
98+
AutoForwardDiff(; chunksize=nothing, tag=nothing)
11399
114-
# Type parameters
100+
Struct used to select the [ForwardDiff.jl](https://github.com/JuliaDiff/ForwardDiff.jl) backend for automatic differentiation.
115101
116-
- `chunksize`: the preferred [chunk size](https://juliadiff.org/ForwardDiff.jl/stable/user/advanced/#Configuring-Chunk-Size) to evaluate several derivatives at once
102+
Exported from [ADTypes.jl](https://github.com/SciML/ADTypes.jl).
117103
118-
# Fields
104+
# Keyword Arguments
119105
106+
- `chunksize`: the preferred [chunk size](https://juliadiff.org/ForwardDiff.jl/stable/user/advanced/#Configuring-Chunk-Size) to evaluate several derivatives at once
120107
- `tag::T`: a [custom tag](https://juliadiff.org/ForwardDiff.jl/release-0.10/user/advanced.html#Custom-tags-and-tag-checking-1) to handle nested differentiation calls (usually not necessary)
121-
122-
# Constructors
123-
124-
AutoForwardDiff(; chunksize=nothing, tag=nothing)
125108
"""
126109
struct AutoForwardDiff{chunksize, T} <: AbstractADType
127110
tag::T
@@ -134,21 +117,16 @@ end
134117
mode(::AutoForwardDiff) = ForwardMode()
135118

136119
"""
137-
AutoPolyesterForwardDiff{chunksize,T}
138-
139-
Chooses [PolyesterForwardDiff.jl](https://github.com/JuliaDiff/PolyesterForwardDiff.jl).
120+
AutoPolyesterForwardDiff(; chunksize=nothing, tag=nothing)
140121
141-
# Type parameters
122+
Struct used to select the [PolyesterForwardDiff.jl](https://github.com/JuliaDiff/PolyesterForwardDiff.jl) backend for automatic differentiation.
142123
143-
- `chunksize`: the preferred [chunk size](https://juliadiff.org/ForwardDiff.jl/stable/user/advanced/#Configuring-Chunk-Size) to evaluate several derivatives at once
124+
Exported from [ADTypes.jl](https://github.com/SciML/ADTypes.jl).
144125
145-
# Fields
126+
# Keyword Arguments
146127
128+
- `chunksize`: the preferred [chunk size](https://juliadiff.org/ForwardDiff.jl/stable/user/advanced/#Configuring-Chunk-Size) to evaluate several derivatives at once
147129
- `tag::T`: a [custom tag](https://juliadiff.org/ForwardDiff.jl/release-0.10/user/advanced.html#Custom-tags-and-tag-checking-1) to handle nested differentiation calls (usually not necessary)
148-
149-
# Constructors
150-
151-
AutoPolyesterForwardDiff(; chunksize=nothing, tag=nothing)
152130
"""
153131
struct AutoPolyesterForwardDiff{chunksize, T} <: AbstractADType
154132
tag::T
@@ -161,17 +139,15 @@ end
161139
mode(::AutoPolyesterForwardDiff) = ForwardMode()
162140

163141
"""
164-
AutoReverseDiff
165-
166-
Chooses [ReverseDiff.jl](https://github.com/JuliaDiff/ReverseDiff.jl).
142+
AutoReverseDiff(; compile=false)
167143
168-
# Fields
144+
Struct used to select the [ReverseDiff.jl](https://github.com/JuliaDiff/ReverseDiff.jl) backend for automatic differentiation.
169145
170-
- `compile::Bool`: whether to [compile the tape](https://juliadiff.org/ReverseDiff.jl/api/#ReverseDiff.compile) prior to differentiation
146+
Exported from [ADTypes.jl](https://github.com/SciML/ADTypes.jl).
171147
172-
# Constructor
148+
# Keyword Arguments
173149
174-
AutoReverseDiff(; compile=false)
150+
- `compile::Bool`: whether to [compile the tape](https://juliadiff.org/ReverseDiff.jl/api/#ReverseDiff.compile) prior to differentiation
175151
"""
176152
Base.@kwdef struct AutoReverseDiff <: AbstractADType
177153
compile::Bool = false
@@ -180,26 +156,22 @@ end
180156
mode(::AutoReverseDiff) = ReverseMode()
181157

182158
"""
183-
AutoSymbolics
184-
185-
Chooses [Symbolics.jl](https://github.com/JuliaSymbolics/Symbolics.jl).
159+
AutoSymbolics()
186160
187-
# Constructor
161+
Struct used to select the [Symbolics.jl](https://github.com/JuliaSymbolics/Symbolics.jl) backend for automatic differentiation.
188162
189-
AutoSymbolics()
163+
Exported from [ADTypes.jl](https://github.com/SciML/ADTypes.jl).
190164
"""
191165
struct AutoSymbolics <: AbstractADType end
192166

193167
mode(::AutoSymbolics) = SymbolicMode()
194168

195169
"""
196-
AutoTapir
197-
198-
Chooses [Tapir.jl](https://github.com/withbayes/Tapir.jl).
170+
AutoTapir()
199171
200-
# Constructor
172+
Struct used to select the [Tapir.jl](https://github.com/withbayes/Tapir.jl) backend for automatic differentiation.
201173
202-
AutoTapir()
174+
Exported from [ADTypes.jl](https://github.com/SciML/ADTypes.jl).
203175
"""
204176
struct AutoTapir <: AbstractADType end
205177

@@ -208,7 +180,9 @@ mode(::AutoTapir) = ReverseMode()
208180
"""
209181
AutoTracker
210182
211-
Chooses [Tracker.jl](https://github.com/FluxML/Tracker.jl).
183+
Struct used to select the [Tracker.jl](https://github.com/FluxML/Tracker.jl) backend for automatic differentiation.
184+
185+
Exported from [ADTypes.jl](https://github.com/SciML/ADTypes.jl).
212186
213187
# Constructor
214188
@@ -219,13 +193,11 @@ struct AutoTracker <: AbstractADType end
219193
mode(::AutoTracker) = ReverseMode()
220194

221195
"""
222-
AutoZygote
223-
224-
Chooses [Zygote.jl](https://github.com/FluxML/Zygote.jl).
196+
AutoZygote()
225197
226-
# Constructor
198+
Struct used to select the [Zygote.jl](https://github.com/FluxML/Zygote.jl) backend for automatic differentiation.
227199
228-
AutoZygote()
200+
Exported from [ADTypes.jl](https://github.com/SciML/ADTypes.jl).
229201
"""
230202
struct AutoZygote <: AbstractADType end
231203

0 commit comments

Comments
 (0)