The shape argument in empty_like (and counterparts: full_like, ones_like and zeros_like) is important to guarantee functions that depend on creation of such arrays (without _like) to work correctly with the introduction of NEP-18 and _meta in Dask arrays. The argument was introduced by numpy/numpy#13046.
An example where we need such functionality is the moment function, creating both ones and zeros, also with non-default chunks:
|
return ones(reduced.shape, chunks=reduced.chunks, dtype='f8') |
The shape argument in
empty_like(and counterparts:full_like,ones_likeandzeros_like) is important to guarantee functions that depend on creation of such arrays (without_like) to work correctly with the introduction of NEP-18 and_metain Dask arrays. The argument was introduced by numpy/numpy#13046.An example where we need such functionality is the
momentfunction, creating bothonesandzeros, also with non-default chunks:dask/dask/array/reductions.py
Line 472 in fb407f5