-
-
Notifications
You must be signed in to change notification settings - Fork 211
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Ref
and broadcasting issue
#1500
Labels
bug
Something isn't working
Comments
Perhaps worth noting that you get a different error if the coefficients are an argument, julia> using Zygote
julia> gradient((x,c) -> sum(evalpoly.(x, Ref(c))), [2.0], [1,2,3])
([14.0], [1.0, 2.0, 4.0])
julia> gradient((x,c) -> sum(evalpoly.(x, Ref(c))), [2.0], [1,2,3.5])
ERROR: DimensionMismatch: array with ndims(x) == 1 > 0 cannot have dx::Number
Stacktrace:
[1] (::ChainRulesCore.ProjectTo{AbstractArray, @NamedTuple{…}})(dx::Float64)
@ ChainRulesCore ~/.julia/packages/ChainRulesCore/6DiyF/src/projection.jl:255
[2] _project
@ ~/.julia/packages/Zygote/jxHJc/src/compiler/chainrules.jl:189 [inlined]
[3] map
@ ./tuple.jl:383 [inlined]
[4] _project_all(x::Tuple{Vector{Float64}, Vector{Float64}}, dx::Tuple{Vector{Float64}, Float64})
@ Zygote ~/.julia/packages/Zygote/jxHJc/src/compiler/interface.jl:118
[5] gradient(::Function, ::Vector{Float64}, ::Vararg{Any})
@ Zygote ~/.julia/packages/Zygote/jxHJc/src/compiler/interface.jl:149
[6] top-level scope
@ REPL[334]:1
Some type information was truncated. Use `show(err)` to see complete types.
julia> Zygote.pullback((x,c) -> sum(evalpoly.(x, Ref(c))), [2.0], [1,2,3.5]) # this avoids projection of final answer
(19.0, Zygote.var"#75#76"{Zygote.Pullback...
julia> ans[2](1.0)
([16.0], 0.0) |
I ran into this today, my coefficients were all Float64s though. What's the underlying issue here, it's not quite clear as a non-expert in Zygote code? 😅 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Additionally if defined like so:
Not sure where to report the bug with cuda
The text was updated successfully, but these errors were encountered: