-
-
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
"size(x) == size(x̄) ? x̄ :" can not take the size, only length #792
Comments
Might be #599 again? But avoiding splatting things of length 784 would be a good idea too, even without Zygote involved. Isn't |
I usually work less with Julia and am therefore rather inexperienced. I think instead of |
Sure, it's hard to know the best way the first time. And doing strange things is a good to find bugs like this one, ideally this ought to work. |
In some ways pushing people to not jump into performance sinks like this would be, is a nice thing, but that's just me. Does |
|
You might need |
|
Hello, I have written a loss function that Zygote cannot handle:
`function loss_ungelabelt2(X,Y)
end
Error:
MethodError: no method matching size(::NTuple{784,Float32})Closest candidates are:
size(::Tuple, !Matched::Integer) at tuple.jl:22
size(!Matched::Flux.OneHotVector) at /Users/lisa/.julia/packages/Flux/IjMZL/src/onehot.jl:8
size(!Matched::ZMQ.Message) at /Users/lisa/.julia/packages/ZMQ/R3wSD/src/message.jl:95
...
Stacktrace:
[1] unbroadcast(::Array{Float32,3}, ::NTuple{784,Float32}) at /Users/lisa/.julia/packages/Zygote/seGHk/src/lib/broadcast.jl:53
[2] (::Zygote.var"#1107#1109"{NTuple{784,Float32}})(::Array{Float32,3}) at /Users/lisa/.julia/packages/Zygote/seGHk/src/lib/broadcast.jl:74
[3] map(::Zygote.var"#1107#1109"{NTuple{784,Float32}}, ::Tuple{Array{Float32,3},Array{Float32,3}}) at ./tuple.jl:158
[4] (::Zygote.var"#1106#1108"{Tuple{Array{Float32,3},Array{Float32,3}}})(::NTuple{784,Float32}) at /Users/lisa/.julia/packages/Zygote/seGHk/src/lib/broadcast.jl:74
[5] (::Zygote.var"#3852#back#1110"{Zygote.var"#1106#1108"{Tuple{Array{Float32,3},Array{Float32,3}}}})(::NTuple{784,Float32}) at /Users/lisa/.julia/packages/ZygoteRules/6nssF/src/adjoint.jl:49
[6] loss_ungelabelt2 at ./In[13]:14 [inlined]
[7] (::typeof(∂(loss_ungelabelt2)))(::Float32) at /Users/lisa/.julia/packages/Zygote/seGHk/src/compiler/interface2.jl:0
[8] (::Zygote.var"#41#42"{typeof(∂(loss_ungelabelt2))})(::Float32) at /Users/lisa/.julia/packages/Zygote/seGHk/src/compiler/interface.jl:45
[9] gradient(::Function, ::Array{Float32,4}, ::Vararg{Any,N} where N) at /Users/lisa/.julia/packages/Zygote/seGHk/src/compiler/interface.jl:54
[10] top-level scope at In[14]:1
[11] include_string(::Function, ::Module, ::String, ::String) at ./loading.jl:1091`
Someone told me that this is a Zygote bug:
"The error is this line
Zygote.jl/src/lib/broadcast.jl
Line 52 in ed366f3
where zygote tries to take size(x̄)
x̄ is turning out to be a Tuple which don’t have size defined on them.
Only length.
However, that is just a symptom, as that line should be fine,
because if x is an Array,
then x̄ should also be an Array.
So something is going wrong somewhere else that is causing it to be a Tuple."
If this was the case, I would be grateful if it could be fixed. Since I am currently writing my bachelor thesis and need the code for it.
The text was updated successfully, but these errors were encountered: