File tree 3 files changed +10
-2
lines changed
array_api_compat/dask/array
3 files changed +10
-2
lines changed Original file line number Diff line number Diff line change @@ -140,7 +140,9 @@ def asarray(
140
140
return da .array (obj , dtype = dtype )
141
141
else :
142
142
if not isinstance (obj , da .Array ) or dtype is not None and obj .dtype != dtype :
143
- obj = np .asarray (obj , dtype = dtype )
143
+ # copy=True to be uniform across dask < 2024.12 and >= 2024.12
144
+ # see https://github.com/dask/dask/pull/11524/
145
+ obj = np .array (obj , dtype = dtype , copy = True )
144
146
return da .from_array (obj )
145
147
return obj
146
148
Original file line number Diff line number Diff line change 1
1
# slow and not implemented in dask
2
2
array_api_tests/test_linalg.py::test_matrix_power
3
+
4
+ # hangs on 2024.12
5
+ array_api_tests/test_creation_functions.py::test_eye
Original file line number Diff line number Diff line change @@ -204,8 +204,11 @@ def test_asarray_copy(library):
204
204
b = asarray (a , copy = None )
205
205
assert is_lib_func (b )
206
206
a [0 ] = 0.0
207
- if library == 'cupy' :
207
+ if library in ( 'cupy' , 'dask.array' ) :
208
208
# A copy is required for libraries where the default device is not CPU
209
+ # dask changed behaviour of copy=None in 2024.12 to copy;
210
+ # this wrapper ensures the same behaviour in older versions too.
211
+ # https://github.com/dask/dask/pull/11524/
209
212
assert all (b [0 ] == 1.0 )
210
213
else :
211
214
assert all (b [0 ] == 0.0 )
You can’t perform that action at this time.
0 commit comments