-
Notifications
You must be signed in to change notification settings - Fork 65
Open
Labels
designRequires some desgin before changes are madeRequires some desgin before changes are madedocumentationImprovements or additions to documentationImprovements or additions to documentationhelp wantedExtra attention is neededExtra attention is needed
Description
This is a general issue, but for a specific incarnation, https://github.com/JuliaDiff/ChainRules.jl/blob/8073c7c4638bdd46f4e822d2ab72423c051c5e4b/src/rulesets/Base/array.jl#L40
function rrule(::typeof(Base.vect), X::Vararg{T, N}) where {T, N}
vect_pullback(ȳ) = (NoTangent(), NTuple{N}(ȳ)...)
return Base.vect(X...), vect_pullback
end
This rule implicitly assumes that ȳ
is a Vector
, but if you are taking a jacobian, it will be a Matrix
in which case, it should be
function rrule(::typeof(Base.vect), X::Vararg{T, N}) where {T, N}
vect_pullback(ȳ) = (NoTangent(), ȳ...)
return Base.vect(X...), vect_pullback
end
Similar problems also exist for the getindex
rrules, and I'm sure there are a bunch of other similar cases.
Is there a good general solution to this?
Metadata
Metadata
Assignees
Labels
designRequires some desgin before changes are madeRequires some desgin before changes are madedocumentationImprovements or additions to documentationImprovements or additions to documentationhelp wantedExtra attention is neededExtra attention is needed