-
Notifications
You must be signed in to change notification settings - Fork 45
Open
Description
Problem:
julia> SparseDiffTools.__test_backend_loaded(ADTypes.AutoForwardDiff())
ERROR: AutoForwardDiff{nothing, Nothing}(nothing) requires ForwardDiff.jl to be loaded. Please load it.
Stacktrace:
[1] error(s::String)
@ Base ./error.jl:35
[2] __test_backend_loaded(ad::AutoForwardDiff{nothing, Nothing})
@ SparseDiffTools ~/.julia/packages/SparseDiffTools/zWIg7/src/highlevel/common.jl:347
[3] top-level scope
@ REPL[41]:1
julia> SparseDiffTools.__test_backend_loaded(ADTypes.AutoReverseDiff())
ERROR: AutoReverseDiff(false) requires nothing.jl to be loaded. Please load it.
Stacktrace:
[1] error(s::String)
@ Base ./error.jl:35
[2] __test_backend_loaded(ad::AutoReverseDiff)
@ SparseDiffTools ~/.julia/packages/SparseDiffTools/zWIg7/src/highlevel/common.jl:347
[3] top-level scope
@ REPL[42]:1
Solution: edit the following lines to add the ReverseDiff case
SparseDiffTools.jl/src/highlevel/common.jl
Lines 344 to 355 in d2f35b7
# Check Backend has been loaded | |
## We pay a small compile time cost for this, but it avoids cryptic error messages | |
@inline function __test_backend_loaded(ad::AbstractADType) | |
error("$(ad) requires $(__backend(ad)).jl to be loaded. Please load it.") | |
end | |
@inline __backend(ad) = nothing | |
@inline __backend(::Union{AutoEnzyme, AutoSparseEnzyme}) = :Enzyme | |
@inline __backend(::Union{AutoZygote, AutoSparseZygote}) = :Zygote | |
@inline __backend(::Union{AutoForwardDiff, AutoSparseForwardDiff}) = :ForwardDiff | |
@inline __backend(::Union{AutoPolyesterForwardDiff, AutoSparsePolyesterForwardDiff}) = :PolyesterForwardDiff | |
@inline __backend(::Union{AutoFiniteDiff, AutoSparseFiniteDiff}) = :FiniteDiff |
Metadata
Metadata
Assignees
Labels
No labels