Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add an error for [I array] #811

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions src/rulesets/Base/array.jl
Original file line number Diff line number Diff line change
Expand Up @@ -220,6 +220,11 @@ end
# All the [hv]cat functions treat anything that's not an array as a scalar.
_catsize(x) = ()
_catsize(x::AbstractArray) = size(x)
_catsize(::LinearAlgebra.UniformScaling) = error(
"""ChainRules does not at present support *cat functions with LinearAlgebra.I
as it does not know how to calculate the size occupied in e.g. `[1:4 I 5:8]`.
Writing instead `[1:4 I(4) 5:8]` should work.
Issue tracking this is here: https://github.com/JuliaDiff/ChainRules.jl/issues/810""")
mcabbott marked this conversation as resolved.
Show resolved Hide resolved

function rrule(::typeof(hcat), Xs...)
Y = hcat(Xs...) # note that Y always has 1-based indexing, even if X isa OffsetArray
Expand Down
Loading