-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Open
Labels
arrayneeds attentionIt's been a while since this was pushed on. Needs attention from the owner or a maintainer.It's been a while since this was pushed on. Needs attention from the owner or a maintainer.
Description
What happened:
I found an example of dask.array slice that has has incorrect shape assigned.
Although compute works correctly, the mismatch causes problems.
E.g. when I try to create another array with same chunks without computing the original one.
What you expected to happen:
- In following example
trouble_slice.shapeandtrouble_slice.compute().shapeshould be the same. - The
da.from_array([[4, 4, 4]], chunks=trouble_slice.chunks)should work without raisingValueError
Minimal Complete Verifiable Example:
import dask.array as da
arr = da.from_array([[1, 2, 3], [4, 5, 6]])
# expected behavior
# shape match when I slice with [1]
ok_slice = arr[da.from_array([1])]
print(ok_slice.shape) # (1, 3)
print(ok_slice.compute().shape) # (1, 3)
# no problem creating another array of expected shape with same chunks
da.from_array([[4, 4, 4]], chunks=ok_slice.chunks)
print('--------------')
# what went wrong
# shape mismatch when I slice with [0]
trouble_slice = arr[da.from_array([0])]
print(trouble_slice.shape) # (2, 3)
print(trouble_slice.compute().shape) # (1, 3)
# probably due to shape mismatch demonstrated above following raises
# ValueError: Chunks do not add up to shape. Got chunks=((2,), (3,)), shape=(1, 3)
da.from_array([[4, 4, 4]], chunks=trouble_slice.chunks)Anything else we need to know?:
Environment:
- Dask version: 2.29.0
- Python version: 3.7.5
- Operating System: Ubuntu
- Install method (conda, pip, source): pip
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
arrayneeds attentionIt's been a while since this was pushed on. Needs attention from the owner or a maintainer.It's been a while since this was pushed on. Needs attention from the owner or a maintainer.