Skip to content

Commit c074b81

Browse files
authored
Merge pull request #209 from mtsokol/default-complex-no-asarray
Add `default_complex` when `xp.asarray` isn't present
2 parents 83f0bcd + ffeb7cb commit c074b81

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

array_api_tests/dtype_helpers.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -235,6 +235,12 @@ class MinMax(NamedTuple):
235235
if not hasattr(xp, "asarray"):
236236
default_int = xp.int32
237237
default_float = xp.float32
238+
# TODO: when api_version > '2021.12', just assign to xp.complex64,
239+
# otherwise default to None. Need array-api spec to be bumped first (#187).
240+
try:
241+
default_complex = xp.complex64
242+
except AttributeError:
243+
default_complex = None
238244
warn(
239245
"array module does not have attribute asarray. "
240246
"default int is assumed int32, default float is assumed float32"

0 commit comments

Comments
 (0)