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

Support FastDifferentiation.jl #34

Merged
merged 2 commits into from
Apr 3, 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
20 changes: 19 additions & 1 deletion src/ADTypes.jl
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ abstract type AbstractSymbolicDifferentiationMode <: AbstractADType end
abstract type AbstractSparseReverseMode <: AbstractReverseMode end
abstract type AbstractSparseForwardMode <: AbstractForwardMode end
abstract type AbstractSparseFiniteDifferences <: AbstractFiniteDifferencesMode end
abstract type AbstractSparseSymbolicDifferentiationMode <:
AbstractSymbolicDifferentiationMode end

"""
AutoChainRules{RC}
Expand Down Expand Up @@ -229,6 +231,20 @@ Chooses [Diffractor.jl](https://github.com/JuliaDiff/Diffractor.jl).
"""
struct AutoDiffractor <: AbstractADType end

"""
AutoFastDifferentiation

Chooses [FastDifferentiation.jl](https://github.com/brianguenter/FastDifferentiation.jl).
"""
struct AutoFastDifferentiation <: AbstractSymbolicDifferentiationMode end
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@brianguenter this one. Right now it has no fields, but it would be the right spot to decide "settings" for the FastDifferentiation backend. You can take a look at the other structs to get an idea of the stuff that goes in there


"""
AutoSparseFastDifferentiation

Chooses [FastDifferentiation.jl](https://github.com/brianguenter/FastDifferentiation.jl) while exploiting sparsity.
"""
struct AutoSparseFastDifferentiation <: AbstractSparseSymbolicDifferentiationMode end

export AutoChainRules,
AutoDiffractor,
AutoFiniteDiff,
Expand All @@ -244,5 +260,7 @@ export AutoChainRules,
AutoSparseZygote,
AutoSparseReverseDiff,
AutoPolyesterForwardDiff,
AutoSparsePolyesterForwardDiff
AutoSparsePolyesterForwardDiff,
AutoFastDifferentiation,
AutoSparseFastDifferentiation
end
8 changes: 8 additions & 0 deletions test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -95,4 +95,12 @@ struct CustomTag end
adtype = AutoDiffractor()
@test adtype isa ADTypes.AbstractADType
@test adtype isa AutoDiffractor

adtype = AutoFastDifferentiation()
@test adtype isa ADTypes.AbstractADType
@test adtype isa AutoFastDifferentiation

adtype = AutoSparseFastDifferentiation()
@test adtype isa ADTypes.AbstractADType
@test adtype isa AutoSparseFastDifferentiation
end
Loading