ENH: Slightly improve error when gufunc axes has wrong size#22675
ENH: Slightly improve error when gufunc axes has wrong size#22675seberg merged 4 commits intonumpy:mainfrom
Conversation
mhvk
left a comment
There was a problem hiding this comment.
Yes, good to be more explicit! One super nitpicky comment; can ignore if you wish.
My hope was to tweak it into something useful that:
a @= b
can raise when `b` should have two dimensions and has two axes specified
but actually only has one.
I didn't succeed, but I still think it a slight improvement to give the
ufunc name and the actual core dimensions.
04d7e37 to
5e15682
Compare
|
@mhvk one thing I noticed looking here, is that if core axes are optional, you cannot omit them by passing a shorter axes tuple. I.e. |
|
@seberg - I think I introduced the ability to give axes just before we allowed for optional axes, so I think it is more a question of oversight... It might actually be quite neat if one could indeed use |
|
p.s. This seems all OK, so fine to merge. |
|
Could these be |
|
Hmmm, right now we only use So yeah, makes sense, although for myself I am happy to not broaden up |
|
Something other than ValueError would be helpful in order to properly catch errors in |
… entries This allows catching the error relatively targeted for in-place matmul `a @= b` which may use this path.
|
Heh, I forgot about that idea... I guess that is a good enough reason here, we might want to do it for more axis/axes related |
|
This is failing. It used to raise |
|
Grrr, restored the |
mhvk
left a comment
There was a problem hiding this comment.
Better logic indeed, even if a bit more tortuous.
mattip
left a comment
There was a problem hiding this comment.
LGTM. I added a release note, please take a look before merging.
|
Thanks Matti, I am not sure we need the note for such a niche change, but it reads well and can't hurt. |
My hope was to tweak it into something useful that:
can raise when
bshould have two dimensions and has two axes specified but actually only has one.I didn't succeed, but I still think it a slight improvement to give the ufunc name and the actual core dimensions.