File tree Expand file tree Collapse file tree 3 files changed +10
-2
lines changed
array_api_compat/dask/array Expand file tree Collapse file tree 3 files changed +10
-2
lines changed Original file line number Diff line number Diff line change @@ -140,7 +140,9 @@ def asarray(
140140 return da .array (obj , dtype = dtype )
141141 else :
142142 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 )
144146 return da .from_array (obj )
145147 return obj
146148
Original file line number Diff line number Diff line change 11# slow and not implemented in dask
22array_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):
204204 b = asarray (a , copy = None )
205205 assert is_lib_func (b )
206206 a [0 ] = 0.0
207- if library == 'cupy' :
207+ if library in ( 'cupy' , 'dask.array' ) :
208208 # 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/
209212 assert all (b [0 ] == 1.0 )
210213 else :
211214 assert all (b [0 ] == 0.0 )
You can’t perform that action at this time.
0 commit comments