JuliaDiff / AbstractDifferentiation.jl

An abstract interface for automatic differentiation.
https://juliadiff.org/AbstractDifferentiation.jl/
MIT License
137 stars 18 forks source link

No method matching ForwardDiffBackend/ZygoteBackend. v1.9 #86

Closed Qfl3x closed 1 year ago

Qfl3x commented 1 year ago

In Version 1.9, ZygoteBackend and ForwardDiffBackend "aren't defined":

ERROR: MethodError: no method matching AbstractDifferentiation.ForwardDiffBackend()

As an example.

I have installed both ForwardDiff and Zygote. This error occurs whether or not the ForwardDiff/Zygote package is loaded or not.

devmotion commented 1 year ago

I can't reproduce this, everything seems to work as expected on my computer:

julia> using AbstractDifferentiation

julia> AbstractDifferentiation.ForwardDiffBackend()
ERROR: MethodError: no method matching AbstractDifferentiation.ForwardDiffBackend()
Stacktrace:
 [1] top-level scope
   @ REPL[4]:1

julia> using ForwardDiff

julia> AbstractDifferentiation.ForwardDiffBackend()
AbstractDifferentiation.ForwardDiffBackend{Nothing}()

julia> AbstractDifferentiation.ZygoteBackend()
ERROR: MethodError: no method matching ZygoteBackend()
Stacktrace:
 [1] top-level scope
   @ REPL[7]:1

julia> using Zygote

julia> AbstractDifferentiation.ZygoteBackend()
AbstractDifferentiation.ReverseRuleConfigBackend{Zygote.ZygoteRuleConfig{Zygote.Context{false}}}(Zygote.ZygoteRuleConfig{Zygote.Context{false}}(Zygote.Context{false}(nothing)))
julia> versioninfo()
Julia Version 1.9.0
Commit 8e630552924 (2023-05-07 11:25 UTC)
Platform Info:
  OS: Linux (x86_64-linux-gnu)
  CPU: 8 × 11th Gen Intel(R) Core(TM) i7-1165G7 @ 2.80GHz
  WORD_SIZE: 64
  LIBM: libopenlibm
  LLVM: libLLVM-14.0.6 (ORCJIT, tigerlake)
  Threads: 3 on 8 virtual cores

(jl_MmMtZU) pkg> st
Status `/tmp/jl_MmMtZU/Project.toml`
  [c29ec348] AbstractDifferentiation v0.5.2
  [f6369f11] ForwardDiff v0.10.35
  [e88e6eb3] Zygote v0.6.61

You have to load the AD package if you want to use the respective backend.

Qfl3x commented 1 year ago

This is odd, now it works somehow, perhaps something happened with package updates. Thanks!