-
-
Notifications
You must be signed in to change notification settings - Fork 10.9k
Allow creation of *_like() arrays of arbitrary shapes #13043
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Labels
Comments
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.
…On Tue, Feb 26, 2019 at 5:10 AM Peter Andreas Entschev < ***@***.***> wrote:
Following the discussion in dask/dask#4462
<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.
@shoyer <https://github.com/shoyer> suggested the following change in
dask/dask#4462 <dask/dask#4462>:
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.
@mrocklin <https://github.com/mrocklin> @hameerabbasi
<https://github.com/hameerabbasi> FYI
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#13043>, or mute the thread
<https://github.com/notifications/unsubscribe-auth/AASszFFKqremlIGGOp6dNb9qHG5GPygrks5vRTJRgaJpZM4bSIyR>
.
|
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. |
I've sent PR #13046 for evaluation/review, please also refer to that for suggested implementation. |
PR merged, closing. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.@shoyer suggested the following change in dask/dask#4462:
I think this is a good solution and I would like to see this implemented. I will be opening a PR for this soon.
@mrocklin @hameerabbasi FYI
The text was updated successfully, but these errors were encountered: