You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Allow creation of *_like() arrays of arbitrary shapes #13043
Following the discussion in dask/dask#4462, in some cases it's necessary to create a new array of the same NumPy-like type (e.g., sparse or CuPy) as the input array. This can be achieved by using {empty,full,ones,zeros}_like() functions. However, this prevents a new array of arbitrary shape to be created.
What about adding a shape keyword argument to NumPy's zeros_like, ones_like and full_like? There's some precedence for overwriting attributes of the original array with the dtype argument already.
I think this is a good solution and I would like to see this implemented. I will be opening a PR for this soon.
This sounds like a good idea to me. For context, @pentschev has been
trying to get dask.array and cupy working for a while and apparently has
run into this limitation several times.
The only possible downside would be if some of these get dispatched through ufuncs right now and that might make things tricky. Other then that, it seems a natural thing to just offer it.
Activity
mrocklin commentedon Feb 26, 2019
seberg commentedon Feb 26, 2019
The only possible downside would be if some of these get dispatched through ufuncs right now and that might make things tricky. Other then that, it seems a natural thing to just offer it.
pentschev commentedon Feb 26, 2019
I've sent PR #13046 for evaluation/review, please also refer to that for suggested implementation.
rgommers commentedon Apr 25, 2019
PR merged, closing.