Skip to content

Commit

Permalink
Inline fast functions before optimize slices in dask.array
Browse files Browse the repository at this point in the history
  • Loading branch information
mrocklin committed Mar 15, 2017
1 parent a36f36d commit ec2283d
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions dask/array/tests/test_optimization.py
Original file line number Diff line number Diff line change
Expand Up @@ -154,3 +154,13 @@ def test_dont_fuse_fancy_indexing_in_getarray_nofancy():

dsk = {'a': (getitem, (getarray_nofancy, 'x', [1, 2, 3]), 0)}
assert optimize_slices(dsk) == dsk


def test_fuse_getarray_with_from_array():
x = np.ones(10)
x = da.from_array(x, chunks=(5,))
y = x.rechunk((4,))
dsk = y._optimize(y.dask, y._keys())
for v in dsk.values():
s = str(v)
assert s.count('getitem') + s.count('getarray') <= 1

0 comments on commit ec2283d

Please sign in to comment.