-
Notifications
You must be signed in to change notification settings - Fork 32
Disallow numeric scalar conversation for non-0D arrays #2223
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
base: master
Are you sure you want to change the base?
Changes from all commits
96c722c
33b2c8d
da2598c
2d4ad51
239e5b1
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -134,9 +134,9 @@ def test_comp_ops(namespace): | |
| pytest.skip("No SYCL devices available") | ||
| X._set_namespace(namespace) | ||
| assert X.__array_namespace__() is namespace | ||
| assert X.__gt__(-1) | ||
| assert X.__ge__(-1) | ||
| assert not X.__lt__(-1) | ||
| assert not X.__le__(-1) | ||
| assert not X.__eq__(-1) | ||
| assert X.__ne__(-1) | ||
| assert dpt.all(X.__gt__(-1)) | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. instead of adding these additional kernel launches, we can just either strip the dimension off of |
||
| assert dpt.all(X.__ge__(-1)) | ||
| assert not dpt.all(X.__lt__(-1)) | ||
| assert not dpt.all(X.__le__(-1)) | ||
| assert not dpt.all(X.__eq__(-1)) | ||
| assert dpt.all(X.__ne__(-1)) | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -18,6 +18,7 @@ | |
|
|
||
| import numpy as np | ||
| import pytest | ||
| from numpy.testing import assert_array_equal | ||
|
|
||
| import dpctl.tensor as dpt | ||
| from dpctl.tests.helper import get_queue_or_skip, skip_if_dtype_not_supported | ||
|
|
@@ -345,11 +346,11 @@ def test_radix_sort_size_1_axis(): | |
|
|
||
| x1 = dpt.ones((), dtype="i1") | ||
| r1 = dpt.sort(x1, kind="radixsort") | ||
| assert r1 == x1 | ||
| assert_array_equal(dpt.asnumpy(r1), dpt.asnumpy(x1)) | ||
|
|
||
| x2 = dpt.ones([1], dtype="i1") | ||
| r2 = dpt.sort(x2, kind="radixsort") | ||
| assert r2 == x2 | ||
| assert_array_equal(dpt.asnumpy(r2), dpt.asnumpy(x2)) | ||
|
|
||
| x3 = dpt.reshape(dpt.arange(10, dtype="i1"), (10, 1)) | ||
| r3 = dpt.sort(x3, kind="radixsort") | ||
|
|
@@ -369,7 +370,7 @@ def test_radix_argsort_size_1_axis(): | |
|
|
||
| x2 = dpt.ones([1], dtype="i1") | ||
| r2 = dpt.argsort(x2, kind="radixsort") | ||
| assert r2 == 0 | ||
| assert dpt.all(r2 == 0) | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. similar to the other test, we can save a kernel launch by stripping the dimension off of |
||
|
|
||
| x3 = dpt.reshape(dpt.arange(10, dtype="i1"), (10, 1)) | ||
| r3 = dpt.argsort(x3, kind="radixsort") | ||
|
|
||
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.
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.
I guess NumPy raises a
TypeErrorbut this really seems like aValueErrorto me