Skip to content

Commit 6a7c2e2

Browse files
committed
ENH: correct Dask capabilities
1 parent 7e1b689 commit 6a7c2e2

File tree

2 files changed

+15
-9
lines changed

2 files changed

+15
-9
lines changed

array_api_compat/dask/array/_info.py

+10-6
Original file line numberDiff line numberDiff line change
@@ -68,11 +68,10 @@ def capabilities(self):
6868
The resulting dictionary has the following keys:
6969
7070
- **"boolean indexing"**: boolean indicating whether an array library
71-
supports boolean indexing. Always ``False`` for Dask.
71+
supports boolean indexing.
7272
7373
- **"data-dependent shapes"**: boolean indicating whether an array
74-
library supports data-dependent output shapes. Always ``False`` for
75-
Dask.
74+
library supports data-dependent output shapes.
7675
7776
See
7877
https://data-apis.org/array-api/latest/API_specification/generated/array_api.info.capabilities.html
@@ -99,9 +98,14 @@ def capabilities(self):
9998
10099
"""
101100
return {
102-
"boolean indexing": False,
103-
"data-dependent shapes": False,
104-
# 'max rank' will be part of the 2024.12 standard
101+
# Dask support boolean indexing as long as the index has known shape.
102+
# The output .shape and .size properties will contain
103+
# a non-compliant math.nan instead of None.
104+
"boolean indexing": True,
105+
# Dask implements unique_values et.al.
106+
# The output .shape and .size properties will contain
107+
# a non-compliant math.nan instead of None.
108+
"data-dependent shapes": True,
105109
"max dimensions": 64,
106110
}
107111

dask-xfails.txt

+5-3
Original file line numberDiff line numberDiff line change
@@ -28,12 +28,14 @@ array_api_tests/test_has_names.py::test_has_names[array_method-to_device]
2828
array_api_tests/test_has_names.py::test_has_names[array_attribute-device]
2929
array_api_tests/test_has_names.py::test_has_names[array_attribute-mT]
3030

31-
# Fails because shape is NaN since we don't materialize it yet
31+
# Data-dependent output shape
32+
# These tests fail as array-api-tests doesn't cope with unknown shapes
33+
# Also, output shape is (math.nan, ) instead of (None, )
34+
# Also, da.unique() doesn't accept equals_nan which causes non-compliant
35+
# output when there are NaNs in the input.
3236
array_api_tests/test_searching_functions.py::test_nonzero
3337
array_api_tests/test_set_functions.py::test_unique_all
3438
array_api_tests/test_set_functions.py::test_unique_counts
35-
36-
# Different error but same cause as above, we're just trying to do ndindex on nan shape
3739
array_api_tests/test_set_functions.py::test_unique_inverse
3840
array_api_tests/test_set_functions.py::test_unique_values
3941

0 commit comments

Comments
 (0)