-
Notifications
You must be signed in to change notification settings - Fork 45
Open
Labels
bugSomething isn't workingSomething isn't working
Description
xp.nonzero
is documented in the spec to require an exception for 0d arrays:
x (array) – input array. Must have a positive rank. If x is zero-dimensional, the function must raise an exception.
Yet the code exercises xp.nonzero
for zero-dimensional arrays and expects the function to returns a tuple of size 1:
array-api-tests/array_api_tests/test_searching_functions.py
Lines 93 to 98 in f82c7bc
out = xp.nonzero(x) | |
if x.ndim == 0: | |
assert len(out) == 1, f"{len(out)=}, but should be 1 for 0-dimensional arrays" | |
else: | |
assert len(out) == x.ndim, f"{len(out)=}, but should be {x.ndim=}" | |
out_size = math.prod(out[0].shape) |
This discrepancy should be fixed, or the spec modified.
honno
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working