Skip to content
Open
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
2 changes: 1 addition & 1 deletion DifferentiationInterface/Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
4 changes: 4 additions & 0 deletions DifferentiationInterface/src/utils/check.jl
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,13 @@ function check_available(backend::MixedMode)
check_available(reverse_backend(backend))
end

check_available(::ADTypes.NoAutoDiff) = throw(ADTypes.NoAutoDiffSelectedError())

"""
check_inplace(backend)

Check whether `backend` supports differentiation of in-place functions and return a `Bool`.
"""
check_inplace(backend::AbstractADType) = Bool(inplace_support(backend))

check_inplace(::ADTypes.NoAutoDiff) = throw(ADTypes.NoAutoDiffSelectedError())
Copy link
Member

Choose a reason for hiding this comment

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

Could you put this one level higher, inside the inplace_support trait?

3 changes: 3 additions & 0 deletions DifferentiationInterface/test/Core/ZeroBackends/test.jl
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@ using Test

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

@test_throws NoAutoDiffSelectedError check_available(NoAutoDiff())
@test_throws NoAutoDiffSelectedError check_inplace(NoAutoDiff())

zero_backends = [AutoZeroForward(), AutoZeroReverse()]

for backend in zero_backends
Expand Down
Loading