We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent c3209f4 commit b792772Copy full SHA for b792772
src/compiler/chainrules.jl
@@ -139,7 +139,7 @@ Safe to apply to arbitrary input.
139
@inline function _project(x::Union{Numeric, Ref{<:Numeric}}, dx)
140
wrap_chainrules_output(ProjectTo(x)(wrap_chainrules_input(dx)))
141
end
142
-_project(x::AbstractArray, dx) = reshape(dx, axes(x))
+_project(x::AbstractArray, dx) = dx isa AbstractArray ? reshape(dx, axes(x)) : dx
143
_project(x, dx) = dx
144
145
# Restore splatted arrays
0 commit comments