Skip to content

Commit 8c13b66

Browse files
committed
Specialize inplace_support for NoAutoDiff, update ChangeLog
1 parent 3930398 commit 8c13b66

File tree

5 files changed

+9
-5
lines changed

5 files changed

+9
-5
lines changed

DifferentiationInterface/CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
77

88
## [Unreleased](https://github.com/JuliaDiff/DifferentiationInterface.jl/compare/DifferentiationInterface-v0.7.7...main)
99

10+
- Support the new `ADTypes.NoAutoDiff` ([#851](https://github.com/JuliaDiff/DifferentiationInterface.jl/pull/851))
11+
1012
## [0.7.7](https://github.com/JuliaDiff/DifferentiationInterface.jl/compare/DifferentiationInterface-v0.7.6...DifferentiationInterface-v0.7.7)
1113

1214
- Improve support for empty inputs (still not guaranteed) ([#835](https://github.com/JuliaDiff/DifferentiationInterface.jl/pull/835))

DifferentiationInterface/src/utils/check.jl

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,5 +24,3 @@ check_available(::ADTypes.NoAutoDiff) = throw(ADTypes.NoAutoDiffSelectedError())
2424
Check whether `backend` supports differentiation of in-place functions and return a `Bool`.
2525
"""
2626
check_inplace(backend::AbstractADType) = Bool(inplace_support(backend))
27-
28-
check_inplace(::ADTypes.NoAutoDiff) = throw(ADTypes.NoAutoDiffSelectedError())

DifferentiationInterface/src/utils/traits.jl

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,8 @@ Return [`InPlaceSupported`](@ref) or [`InPlaceNotSupported`](@ref) in a statical
2323
"""
2424
inplace_support(::AbstractADType) = InPlaceSupported()
2525

26+
inplace_support(::ADTypes.NoAutoDiff) = throw(ADTypes.NoAutoDiffSelectedError())
27+
2628
function inplace_support(backend::SecondOrder)
2729
if inplace_support(inner(backend)) isa InPlaceSupported &&
2830
inplace_support(outer(backend)) isa InPlaceSupported

DifferentiationInterface/test/Core/Internals/backends.jl

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,11 @@ using Test
1818
fb = AutoSimpleFiniteDiff()
1919
rb = AutoReverseFromPrimitive(AutoSimpleFiniteDiff())
2020

21+
@testset "NoAutoDiff" begin
22+
@test_throws NoAutoDiffSelectedError check_available(NoAutoDiff())
23+
@test_throws NoAutoDiffSelectedError inplace_support(NoAutoDiff())
24+
end
25+
2126
@testset "SecondOrder" begin
2227
backend = SecondOrder(fb, rb)
2328
@test check_available(backend)

DifferentiationInterface/test/Core/ZeroBackends/test.jl

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,6 @@ using Test
1010

1111
LOGGING = get(ENV, "CI", "false") == "false"
1212

13-
@test_throws NoAutoDiffSelectedError check_available(NoAutoDiff())
14-
@test_throws NoAutoDiffSelectedError check_inplace(NoAutoDiff())
15-
1613
zero_backends = [AutoZeroForward(), AutoZeroReverse()]
1714

1815
for backend in zero_backends

0 commit comments

Comments
 (0)