Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion array_api_compat/dask/array/_aliases.py
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,9 @@ def asarray(
return da.array(obj, dtype=dtype)
else:
if not isinstance(obj, da.Array) or dtype is not None and obj.dtype != dtype:
obj = np.asarray(obj, dtype=dtype)
# copy=True to be uniform across dask < 2024.12 and >= 2024.12
# see https://github.com/dask/dask/pull/11524/
obj = np.array(obj, dtype=dtype, copy=True)
return da.from_array(obj)
return obj

Expand Down
3 changes: 3 additions & 0 deletions dask-skips.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,5 @@
# slow and not implemented in dask
array_api_tests/test_linalg.py::test_matrix_power

# hangs on 2024.12
array_api_tests/test_creation_functions.py::test_eye
4 changes: 3 additions & 1 deletion tests/test_common.py
Original file line number Diff line number Diff line change
Expand Up @@ -204,8 +204,10 @@ def test_asarray_copy(library):
b = asarray(a, copy=None)
assert is_lib_func(b)
a[0] = 0.0
if library == 'cupy':
if library in ('cupy', 'dask.array'):
# A copy is required for libraries where the default device is not CPU
# dask made a breaking change in 2024.12: copy=None copies
# https://github.com/dask/dask/pull/11524/
assert all(b[0] == 1.0)
else:
assert all(b[0] == 0.0)
Loading