Zygote.jl
Zygote.jl copied to clipboard
Issue with comparison operator and cuarrays
This has emerged in https://github.com/FluxML/Flux.jl/issues/1128
julia> using Zygote, CuArrays
julia> gradient(x -> sum(x .< 1), rand(2))
(nothing,)
julia> gradient(x -> sum(x .< 1), rand(2) |> cu)
ERROR: MethodError: no method matching iterate(::Nothing)
Closest candidates are:
iterate(::Core.SimpleVector) at essentials.jl:603
iterate(::Core.SimpleVector, ::Any) at essentials.jl:603
iterate(::ExponentialBackOff) at error.jl:253
...
Stacktrace:
[1] (::Zygote.var"#1938#1943"{Zygote.var"#1780#1784"})(::CuArray{Bool,1,Nothing}) at /home/carlo/.julia/packages/Zygote/YeCEW/src/lib/broadcast.jl:198
[2] (::Zygote.var"#68#back#1944"{Zygote.var"#1938#1943"{Zygote.var"#1780#1784"}})(::CuArray{Bool,1,Nothing}) at /home/carlo/.julia/packages/ZygoteRules/6nssF/src/adjoint.jl:49
[3] (::Zygote.var"#174#175"{Zygote.var"#68#back#1944"{Zygote.var"#1938#1943"{Zygote.var"#1780#1784"}},Tuple{NTuple{4,Nothing},Tuple{}}})(::CuArray{Bool,1,Nothing}) at /home/carlo/.julia/packages/Zygote/YeCEW/src/lib/lib.jl:182
[4] (::Zygote.var"#347#back#176"{Zygote.var"#174#175"{Zygote.var"#68#back#1944"{Zygote.var"#1938#1943"{Zygote.var"#1780#1784"}},Tuple{NTuple{4,Nothing},Tuple{}}}})(::CuArray{Bool,1,Nothing}) at /home/carlo/.julia/packages/ZygoteRules/6nssF/src/adjoint.jl:49
[5] broadcasted at ./broadcast.jl:1238 [inlined]
[6] #48 at ./REPL[83]:1 [inlined]
[7] (::typeof(∂(#48)))(::Int64) at /home/carlo/.julia/packages/Zygote/YeCEW/src/compiler/interface2.jl:0
[8] (::Zygote.var"#36#37"{typeof(∂(#48))})(::Int64) at /home/carlo/.julia/packages/Zygote/YeCEW/src/compiler/interface.jl:46
[9] gradient(::Function, ::CuArray{Float32,1,Nothing}) at /home/carlo/.julia/packages/Zygote/YeCEW/src/compiler/interface.jl:55
[10] top-level scope at REPL[83]:1
[11] eval(::Module, ::Any) at ./boot.jl:331
[12] eval_user_input(::Any, ::REPL.REPLBackend) at /home/carlo/julia/julia-1.4.1/share/julia/stdlib/v1.4/REPL/src/REPL.jl:86
[13] run_backend(::REPL.REPLBackend) at /home/carlo/.julia/packages/Revise/kqqw8/src/Revise.jl:1163
[14] top-level scope at none:0