-
-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Closed
Milestone
Description
The code below fails in dask 0.9.0, numpy 1.11.0, toolz 0.7.4, Python 2.7:
import numpy as np
import dask.array as da
a = np.arange(5).astype(np.int32)
d = da.from_array(a, (1,))
print(d.dtype)
e = d.astype(np.int16)
print(e.dtype)
print(e.compute())with the exception
Traceback (most recent call last):
File "./dask-astype.py", line 8, in <module>
e = d.astype(np.int16)
File "/home/bmerry/work/sdp/env/local/lib/python2.7/site-packages/dask/array/core.py", line 1091, in astype
return elemwise(_astype, self, dtype, name=name)
File "/home/bmerry/work/sdp/env/local/lib/python2.7/site-packages/dask/array/core.py", line 2159, in elemwise
out_ndim = len(broadcast_shapes(*shapes)) # Raises ValueError if dimensions mismatch
File "/home/bmerry/work/sdp/env/local/lib/python2.7/site-packages/dask/array/core.py", line 2131, in broadcast_shapes
for sizes in zip_longest(*map(reversed, shapes), fillvalue=1):
TypeError: type object argument after * must be a sequence, not itertools.imap
If one passes np.dtype(np.int16) instead of just np.int16, then it works. The problem seems to be that the np.int16.shape attribute exists, but isn't a sequence. Possibly this can be fixed by adding dtype = np.dtype(dtype) to the start ofArray.astype`.
Metadata
Metadata
Assignees
Labels
No labels