Skip to content

Commit ec248df

Browse files
Merge pull request #34 from SciML/gd/new_types
Support FastDifferentiation.jl
2 parents 93b8c6c + 13857fb commit ec248df

File tree

2 files changed

+27
-1
lines changed

2 files changed

+27
-1
lines changed

src/ADTypes.jl

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@ abstract type AbstractSymbolicDifferentiationMode <: AbstractADType end
1818
abstract type AbstractSparseReverseMode <: AbstractReverseMode end
1919
abstract type AbstractSparseForwardMode <: AbstractForwardMode end
2020
abstract type AbstractSparseFiniteDifferences <: AbstractFiniteDifferencesMode end
21+
abstract type AbstractSparseSymbolicDifferentiationMode <:
22+
AbstractSymbolicDifferentiationMode end
2123

2224
"""
2325
AutoChainRules{RC}
@@ -233,6 +235,20 @@ Chooses [Diffractor.jl](https://github.com/JuliaDiff/Diffractor.jl).
233235
"""
234236
struct AutoDiffractor <: AbstractADType end
235237

238+
"""
239+
AutoFastDifferentiation
240+
241+
Chooses [FastDifferentiation.jl](https://github.com/brianguenter/FastDifferentiation.jl).
242+
"""
243+
struct AutoFastDifferentiation <: AbstractSymbolicDifferentiationMode end
244+
245+
"""
246+
AutoSparseFastDifferentiation
247+
248+
Chooses [FastDifferentiation.jl](https://github.com/brianguenter/FastDifferentiation.jl) while exploiting sparsity.
249+
"""
250+
struct AutoSparseFastDifferentiation <: AbstractSparseSymbolicDifferentiationMode end
251+
236252
export AutoChainRules,
237253
AutoDiffractor,
238254
AutoFiniteDiff,
@@ -248,5 +264,7 @@ export AutoChainRules,
248264
AutoSparseZygote,
249265
AutoSparseReverseDiff,
250266
AutoPolyesterForwardDiff,
251-
AutoSparsePolyesterForwardDiff
267+
AutoSparsePolyesterForwardDiff,
268+
AutoFastDifferentiation,
269+
AutoSparseFastDifferentiation
252270
end

test/runtests.jl

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,4 +98,12 @@ struct CustomTag end
9898
adtype = AutoDiffractor()
9999
@test adtype isa ADTypes.AbstractADType
100100
@test adtype isa AutoDiffractor
101+
102+
adtype = AutoFastDifferentiation()
103+
@test adtype isa ADTypes.AbstractADType
104+
@test adtype isa AutoFastDifferentiation
105+
106+
adtype = AutoSparseFastDifferentiation()
107+
@test adtype isa ADTypes.AbstractADType
108+
@test adtype isa AutoSparseFastDifferentiation
101109
end

0 commit comments

Comments
 (0)