-
-
Notifications
You must be signed in to change notification settings - Fork 213
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
MethodError: no method matching +(::Nothing, ::Array{Float32,2}) #454
Comments
Looks like this has to do with broadcating as replacing restack(xs) = vcat.(xs[1:2:end], xs[2:2:end]) with restack(xs) = [vcat(xs[i-1], xs[i]) for i ∈ 2:2:lastindex(xs)] works around this issue |
exact same problem, same workaround
|
Here is the MRE: using Zygote
vs = [rand(2,3) for _ ∈ 1:4]
julia> gradient(xs -> sum(sum(vcat.(xs[1:2:end], xs[2:2:end]))), vs)
ERROR: MethodError: no method matching +(::Nothing, ::Array{Float64,2}) Can someone advise what is the problem here? |
Further reduced to: using Zygote
julia> gradient(xs -> sum(sum(vcat.(xs[:], xs))), [rand(2), rand(2)])
ERROR: MethodError: no method matching +(::Nothing, ::FillArrays.Fill{Float64,1,Tuple{Base.OneTo{Int64}}}) |
Looks like a bug in the custom adjoint for sum, This would not happen if Zygote was using ChainRules.jl’s differential types. But right now that custom adjoint need to be written to know some args might be |
This issue is affecting me gravely. Any suggestions on how to fix it? |
Type pirate |
I've been hitting this also, and @oxinabox's type piracy hack is working for now. Thanks. |
Seems fixed on master, so will close. |
I'm trying to implement pyramidal BLSTM in Flux with Zygote backend and getting an error I cannot comprehend. Here is MWE:
where the call to
gradient
at the end throws:Any advice on what is the problem here and how to fix it? I'm happy to prepare PR fixing it
The text was updated successfully, but these errors were encountered: