Skip to content

Commit fc51052

Browse files
committed
Update comment
1 parent f246691 commit fc51052

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

src/rulesets/Base/array.jl

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -37,10 +37,13 @@ function rrule(
3737
return Base.vect(X...), vect_pullback
3838
end
3939

40-
# This rule isn't certain to be correct, if someone has overloaded `Base.vect` for their type
41-
# in a way that has a non-identity derivative; but that is a very weird thing to do.
42-
# so we are confident that this is safe.
43-
# Zygote and Diffractor fall over completely without this rule.
40+
# This rule isn't certain to be correct.
41+
# This rule _is_ correct when elements of `X` pass straight through into the output without
42+
# modification. e.g. if the output type of `vect` is a `Vector{Any}`, then this should be
43+
# correct. If, however, the type of some elements of `X` change in this operation in such a
44+
# way that their cotangents require projection on the reverse pass of AD, this projection
45+
# won't happen, possibly causing problems later on in the reverse pass.
46+
# Zygote and Diffractor fall over completely without this rule.
4447
function rrule(::typeof(Base.vect), X::Vararg{Any,N}) where {N}
4548
vect_pullback(ȳ) = (NoTangent(), ntuple(n -> ȳ[n], N)...)
4649
return Base.vect(X...), vect_pullback

0 commit comments

Comments
 (0)