Skip to content

Commit

Permalink
Handle Dask's renaming of atop to blockwise (#98)
Browse files Browse the repository at this point in the history
Newer versions of Dask have renamed `atop` to `blockwise`. Handle this
by trying to import `blockwise` and falling back to `atop` if
`blockwise` cannot be found.
  • Loading branch information
jakirkham committed Feb 4, 2019
1 parent edf5bab commit e3b746d
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion dask_image/ndmeasure/_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,12 @@
import dask.array


try:
from dask.array import blockwise as da_blockwise
except ImportError:
from dask.array import atop as da_blockwise


def _norm_input_labels_index(input, labels=None, index=None):
"""
Normalize arguments to a standard form.
Expand Down Expand Up @@ -64,7 +70,7 @@ def _ravel_shape_indices(dimensions, dtype=int, chunks=None):
for i, c in enumerate(chunks)
]

indices = dask.array.atop(
indices = da_blockwise(
_ravel_shape_indices_kernel, tuple(range(len(indices))),
*sum([(a, (i,)) for i, a in enumerate(indices)], tuple()),
dtype=dtype
Expand Down

0 comments on commit e3b746d

Please sign in to comment.