-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Allow `bool` in `sum` and `prod` * Make dtype checking more lenient in case of 'all'
- Loading branch information
Showing
3 changed files
with
31 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
from numpy.testing import assert_array_equal | ||
|
||
import cubed.array_api as xp | ||
|
||
|
||
# This is less strict than the spec, but is supported by implementations like NumPy | ||
def test_prod_sum_bool(): | ||
a = xp.ones((2,), dtype=xp.bool) | ||
assert_array_equal(xp.prod(a).compute(), xp.asarray([1], dtype=xp.int64)) | ||
assert_array_equal(xp.sum(a).compute(), xp.asarray([2], dtype=xp.int64)) |