ChainRules.jl icon indicating copy to clipboard operation
ChainRules.jl copied to clipboard

Rules for zip missing

Open AlexRobson opened this issue 4 years ago • 1 comments

Probably this generalises to others in Base.Iterators

Sometimes this works in Zygote and sometimes it doesn't - i haven't worked out what the difference is:

x, y = rand(3,), rand(3,)
Zygote.gradient(() -> sum(first(zip(x, y)))) # works
Zygote.gradient(() -> sum(map(_ -> 1.0, (x, y)))) # works
Zygote.gradient(() -> sum(map(_ -> 1.0, zip(x, y)))) # errors Need an adjoint for constructor Base.Iterators.Zip{Tuple{Vector{Float64}, Vector{Float64}}}

Anyway, it looks like zip is missing from CR.

AlexRobson avatar Aug 20 '21 10:08 AlexRobson

Xref an attempt to do this within Zygote: https://github.com/FluxML/Zygote.jl/pull/785 Which always got stuck on yet more weird cases.

mcabbott avatar Aug 20 '21 14:08 mcabbott