Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Consolidate summation in
_ravel_shape_indices
(#72)
Instead of using the Python `sum` function on Dask Arrays, which will handle the reduction one pair at a time thus generating a large graph, use `atop` with a special summation kernel. This handles summation of all of the Dask Arrays in one function and returns the result. Thus simplifying the addition into one node. To simplify the Dask graph further, move the creation of singleton axes into the `_ravel_shape_indices` kernel function as well. This avoids adding these steps needlessly to the graph of each `arange`. Plus NumPy should be able to do these for basically free. As a result graph construction by `_ravel_shape_indices` should be merely using `arange` to construct indices for each dimensions and combining these into the resultant raveled indices with `atop` and the custom kernel function.
- Loading branch information