-
-
Notifications
You must be signed in to change notification settings - Fork 217
Closed
Description
The bug reported here https://discourse.julialang.org/t/help-me-pin-this-bug-in-flux/81901 can be simplified a little further. Note that the error occurs on the forward pass, and requires an array of booleans:
julia> z, back = pullback([true, false]) do x
y2 = reshape(x, 1, 2, 1)
y3 = repeat(y2, 3)
y3[1]
end
ERROR: type Nothing has no field method
Stacktrace:
[1] getproperty(x::Nothing, f::Symbol)
@ Base ./Base.jl:37
[2] matching_cr_sig(t::IRTools.Inner.Meta, s::Nothing)
@ Zygote ~/.julia/packages/Zygote/DkIUK/src/compiler/chainrules.jl:72
[3] has_chain_rrule(T::Type)
@ Zygote ~/.julia/packages/Zygote/DkIUK/src/compiler/chainrules.jl:54
[4] #s53#1205
@ ~/.julia/packages/Zygote/DkIUK/src/compiler/interface2.jl:20 [inlined]
[5] var"#s53#1205"(::Any, ctx::Any, f::Any, args::Any)
@ Zygote ./none:0
[6] (::Core.GeneratedFunctionStub)(::Any, ::Vararg{Any})
...
julia> gradient([true, false]) do x
y2 = reshape(x, 1, 2, 1) .+ 0.0
y3 = repeat(y2, 3)
y3[1]
end
(nothing,)
julia> gradient([1, 0]) do x
y2 = reshape(x, 1, 2, 1)
y3 = repeat(y2, 3)
y3[1]
end
([1.0, 0.0],)
In testing variants, I also got this error, which is unrelated I think. But similar to JuliaDiff/ChainRules.jl#627
julia> gradient([true, false]) do x
y2 = reshape(x, 1, 2, 1)
@show summary(y2)
y3 = repeat(y2, outer=3)
@show summary(y3)
y3[1]
end
summary(y2) = "1×2×1 Array{Bool, 3}"
ERROR: ArgumentError: number of outer repetitions (1) cannot be less than number of dimensions of input array (3)
Stacktrace:
[1] check(arr::Array{Bool, 3}, inner::Tuple{Int64, Int64, Int64}, outer::Int64)
@ Base._RepeatInnerOuter ./abstractarraymath.jl:453
[2] repeat(arr::Array{Bool, 3}; inner::Tuple{Int64, Int64, Int64}, outer::Int64)
@ Base._RepeatInnerOuter ./abstractarraymath.jl:399
[3] repeat(A::Array{Bool, 3}; inner::Tuple{Int64, Int64, Int64}, outer::Int64)
@ Base ./abstractarraymath.jl:393
[4] #adjoint#511
@ ~/.julia/packages/Zygote/DkIUK/src/lib/array.jl:120 [inlined]
[5] _pullback
@ ~/.julia/packages/ZygoteRules/AIbCs/src/adjoint.jl:71 [inlined]
...
julia> Zygote.gradient(rand(1,2,1)) do x
repeat(x, outer=3)[1]
end
ERROR: ArgumentError: number of outer repetitions (1) cannot be less than number of dimensions of input array (3)
ToucheSir
Metadata
Metadata
Assignees
Labels
No labels