Issue with the gradient function
- Dominant language
- Julia
- Stars
- 54
- Forks
- 37
- Avg merge
- 5h 49m
- Merged PRs (30d)
- 1
Description
I am working with Julia v1.6.7 and trying to execute this code:
W = rand(2, 5)
b = rand(2)
linear(x) = W * x .+ b
grads = gradient(() -> sum(linear(x)), Params([W, b]))
but I receive the error:
MethodError: no method matching back!(::Float64)
Closest candidates are:
back!(::Any, ::Any; once) at C:\Users\choud\.julia\packages\Tracker\tdXqL\src\back.jl:74
back!(::Tracker.TrackedReal; once) at C:\Users\choud\.julia\packages\Tracker\tdXqL\src\lib\real.jl:15
back!(::Tracker.TrackedArray) at C:\Users\choud\.julia\packages\Tracker\tdXqL\src\lib\array.jl:68
Stacktrace:
[1] gradient_(f::var"#96#97", xs::Tracker.Params)
@ Tracker C:\Users\choud\.julia\packages\Tracker\tdXqL\src\back.jl:4
[2] gradient_(f::Function, ps::Params{Zygote.Buffer{Array{Float64, N} where N, Vector{Array{Float64, N} where N}}})
@ Zygote.ZygoteTrackerExt C:\Users\choud\.julia\packages\Zygote\4SSHS\ext\ZygoteTrackerExt.jl:15
[3] #gradient#689
@ C:\Users\choud\.julia\packages\Tracker\tdXqL\src\back.jl:164 [inlined]
[4] gradient(f::Function, xs::Params{Zygote.Buffer{Array{Float64, N} where N, Vector{Array{Float64, N} where N}}})
@ Tracker C:\Users\choud\.julia\packages\Tracker\tdXqL\src\back.jl:164
[5] top-level scope
@ In[80]:4
Does this have to do anything with the version of my Julia
Contributor guide
No contributing guide indexed for this repository
Research direction
Reproduce the example with Julia v1.6.7, then start with the reported frames in Tracker/src/back.jl and ZygoteTrackerExt.jl, especially the back! calls. Compare the behavior with the supported Julia and dependency versions; done means identifying the compatibility or usage cause and documenting a confirmed resolution.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- julia
- Domain
- machine-learning
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 30/100