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

No rules for `typed_hvcat`

Open MasonProtter opened this issue 2 years ago • 1 comments

This causes problems with Zygote:

julia> using Zygote

julia> gradient(x -> sum([x x]), pi/2)
(2.0,)

julia> gradient(x -> sum(Float32[x x]), pi/2)
ERROR: Mutating arrays is not supported -- called setindex!(Matrix{Float32}, ...)
...
  [7] typed_hcat
    @ Zygote ./abstractarray.jl:1610 [inlined]

Ideally we'd teach ChainRules how to handled this statement without going through to the implementation.

MasonProtter avatar Sep 29 '23 15:09 MasonProtter

See also #695

mcabbott avatar Oct 24 '23 18:10 mcabbott