diff --git a/DifferentiationInterface/CHANGELOG.md b/DifferentiationInterface/CHANGELOG.md index c60369666..a5405599f 100644 --- a/DifferentiationInterface/CHANGELOG.md +++ b/DifferentiationInterface/CHANGELOG.md @@ -7,6 +7,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased](https://github.com/JuliaDiff/DifferentiationInterface.jl/compare/DifferentiationInterface-v0.7.7...main) + - Support the new `ADTypes.NoAutoDiff` ([#851](https://github.com/JuliaDiff/DifferentiationInterface.jl/pull/851)) + ## [0.7.7](https://github.com/JuliaDiff/DifferentiationInterface.jl/compare/DifferentiationInterface-v0.7.6...DifferentiationInterface-v0.7.7) - Improve support for empty inputs (still not guaranteed) ([#835](https://github.com/JuliaDiff/DifferentiationInterface.jl/pull/835)) diff --git a/DifferentiationInterface/Project.toml b/DifferentiationInterface/Project.toml index 372a97de8..3654bf71f 100644 --- a/DifferentiationInterface/Project.toml +++ b/DifferentiationInterface/Project.toml @@ -56,7 +56,7 @@ DifferentiationInterfaceTrackerExt = "Tracker" DifferentiationInterfaceZygoteExt = ["Zygote", "ForwardDiff"] [compat] -ADTypes = "1.17.0" +ADTypes = "1.18.0" ChainRulesCore = "1.23.0" DiffResults = "1.1.0" Diffractor = "=0.2.6" diff --git a/DifferentiationInterface/src/utils/check.jl b/DifferentiationInterface/src/utils/check.jl index 9e0510533..311da5ef6 100644 --- a/DifferentiationInterface/src/utils/check.jl +++ b/DifferentiationInterface/src/utils/check.jl @@ -16,6 +16,8 @@ function check_available(backend::MixedMode) check_available(reverse_backend(backend)) end +check_available(::ADTypes.NoAutoDiff) = throw(ADTypes.NoAutoDiffSelectedError()) + """ check_inplace(backend) diff --git a/DifferentiationInterface/src/utils/traits.jl b/DifferentiationInterface/src/utils/traits.jl index 8a059870c..b1f4ed5b5 100644 --- a/DifferentiationInterface/src/utils/traits.jl +++ b/DifferentiationInterface/src/utils/traits.jl @@ -23,6 +23,8 @@ Return [`InPlaceSupported`](@ref) or [`InPlaceNotSupported`](@ref) in a statical """ inplace_support(::AbstractADType) = InPlaceSupported() +inplace_support(::ADTypes.NoAutoDiff) = throw(ADTypes.NoAutoDiffSelectedError()) + function inplace_support(backend::SecondOrder) if inplace_support(inner(backend)) isa InPlaceSupported && inplace_support(outer(backend)) isa InPlaceSupported diff --git a/DifferentiationInterface/test/Core/Internals/backends.jl b/DifferentiationInterface/test/Core/Internals/backends.jl index 5ce73706f..43bb4f1f3 100644 --- a/DifferentiationInterface/test/Core/Internals/backends.jl +++ b/DifferentiationInterface/test/Core/Internals/backends.jl @@ -18,6 +18,11 @@ using Test fb = AutoSimpleFiniteDiff() rb = AutoReverseFromPrimitive(AutoSimpleFiniteDiff()) +@testset "NoAutoDiff" begin + @test_throws NoAutoDiffSelectedError check_available(NoAutoDiff()) + @test_throws NoAutoDiffSelectedError inplace_support(NoAutoDiff()) +end + @testset "SecondOrder" begin backend = SecondOrder(fb, rb) @test check_available(backend)