From e3ab11ac686aa697847be5b59e31f8dd163d413d Mon Sep 17 00:00:00 2001 From: Guillaume Dalle <22795598+gdalle@users.noreply.github.com> Date: Mon, 11 Mar 2024 17:09:08 +0100 Subject: [PATCH] Add AutoDiffractor --- README.md | 3 ++- src/ADTypes.jl | 8 ++++++++ test/runtests.jl | 4 ++++ 3 files changed, 14 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index c067efb..b8c3242 100644 --- a/README.md +++ b/README.md @@ -13,9 +13,10 @@ Just run the following code in a Julia REPL to find out: julia> using ADTypes julia> names(ADTypes) -16-element Vector{Symbol}: +17-element Vector{Symbol}: :ADTypes :AutoChainRules + :AutoDiffractor :AutoEnzyme :AutoFiniteDiff :AutoFiniteDifferences diff --git a/src/ADTypes.jl b/src/ADTypes.jl index 98ebe87..965afa5 100644 --- a/src/ADTypes.jl +++ b/src/ADTypes.jl @@ -222,7 +222,15 @@ Base.@kwdef struct AutoSparseReverseDiff <: AbstractSparseReverseMode compile::Bool = false end +""" + AutoDiffractor + +Chooses [Diffractor.jl](https://github.com/JuliaDiff/Diffractor.jl). +""" +struct AutoDiffractor <: AbstractADType end + export AutoChainRules, + AutoDiffractor, AutoFiniteDiff, AutoFiniteDifferences, AutoForwardDiff, diff --git a/test/runtests.jl b/test/runtests.jl index 2d874fc..1f18a10 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -91,4 +91,8 @@ struct CustomTag end adtype = AutoEnzyme(; mode = Val(:Reverse)) @test adtype isa ADTypes.AbstractADType @test adtype isa AutoEnzyme{Val{:Reverse}} + + adtype = AutoDiffractor() + @test adtype isa ADTypes.AbstractADType + @test adtype isa AutoDiffractor end