-
-
Notifications
You must be signed in to change notification settings - Fork 10.8k
BUG: add a specialized loop for boolean matmul #14464
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
Conversation
numpy/core/tests/test_multiarray.py
Outdated
assert np.max(a.view(np.int8)) == 1 | ||
b = np.matmul(a, a) | ||
# matmul with boolean output should always be 0, 1 | ||
assert np.max(b.view(np.int8)) == 1 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could be nice to have a larger than 2x2 array as well I guess. And while we are at it, ensure:
np.matmul(np.empty((2, 0), dtype=np.bool_), np.empty(0, dtype=np.bool_))
gives [False, False]
(that is what dot gives, I assume it is correct, heh).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should probably view as uint8
here, since currently this test won't detect -1
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed uint8
, added more tests. np.empty
gives uninitialized memory, used np.zeros
instead.
If cblas couldn't be used, it was done with einsum
|
Put release note label, but since this is going to be backported and the backports have the shortlist, and it is pretty obvious, maybe that is unnecessary. |
There are compiler warnings... |
grr. We should move the compiler-warning-check code from |
tests pass |
OK, lets put this in. Thanks Matti! |
Fixes gh-14439
Not sure whether this should be labelled a bug or a regression, since the original matmul was based on dot and so most likely worked properly. If a regression the test should move to the proper place.