We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent f80ef94 commit b020a2aCopy full SHA for b020a2a
src/rulesets/Base/iterators.jl
@@ -21,7 +21,9 @@ end
21
##### `zip`
22
#####
23
24
-function rrule(::typeof(zip), xs::AbstractArray...)
+# Attaching the rule to `zip` breaks Zygote, whose rule is on `Iterators.Zip`.
25
+# function rrule(::typeof(zip), xs::AbstractArray...)
26
+function rrule(::Type{<:Iterators.Zip}, xs::Tuple{Vararg{AbstractArray}})
27
function zip_pullback(dy)
28
@debug "zip array pullback" summary(dy)
29
dxs = _tangent_unzip(unthunk(dy))
@@ -52,7 +54,7 @@ end
52
54
53
55
# For testing
56
function rrule(::ComposedFunction{typeof(collect), typeof(zip)}, xs::AbstractArray...)
- y, back = rrule(zip, xs...)
57
+ y, back = rrule(Iterators.Zip, xs)
58
return collect(y), back
59
end
60
0 commit comments