-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Implement np.tile #5785
base: main
Are you sure you want to change the base?
Implement np.tile #5785
Conversation
Add basic support for np.tile, limited to when the first input (the tiles) have at most 1 dimension. Includes documentation and tests. Could easily scale to arbitrary-dimensional inputs if the tuple constructor were supported (so the output shape could be computed at runtime). Fixes numba#2327 Fixes numba#3456
Thanks for the patch. There's a few tricks to do tuple generation. Do you want to perhaps get this restricted version in first and then work on expanding it? |
@stuartarchibald Sure, if you think that would be best. What are the tricks? |
Btw, shouldn't this be implemented in |
Yeah, probably. I think my rationale was that |
… once in second implementation
what is the status on merging this in, this feature would be great |
I'd also like to join the chorus of requestors. Tile is such a useful utility function it can entail quite a bit of refactoring to replace it! |
After merging master into this branch there is a small conflict which is trivial to resolve, and the added tests of |
@@ -1712,7 1712,7 @@ def np_triu_indices_from_impl(arr, k=0): | |||
return np_triu_indices_from_impl | |||
|
|||
|
|||
def _prepare_array(arr): | |||
def _prepare_array(arr) -> np.ndarray: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure how this type annotation got in here - my guess is that it was removed some time in the last several months after I originally branched, and then git put it back when I merged master into the feature branch.
Thanks for the update! I've added this to the review queue, and put it in the 0.54 milestone to make sure it doesn't get passed over or omitted from consideration for the next release without proper consideration. |
Excited to use this in anger! One less impediment to decorating a function and being off to the races. Thanks a lot guys, very much appreciated! |
It would be great to have this functionality. Is this functionality going to be merged sometime soon? Seems like this PR was added for a review for 0.54 release. Is anyone still working on this or this PR stale? |
Hello, it would be useful to have a built-in implementation of np.tile. Hope it will be merge in the future. |
Is anyone still working on this or this PR? |
probably not, it's been stale for over a year now. |
I was involved when this first 'came back alive'. I didn't catch that it was never infact merged. Thats a bummer. @gmarkall would it possible to get this reviewed again and pushed to be added to the next release? Do we know why it dropped off the radar? |
Add basic support for np.tile, limited to when the first input (the tiles) have at most 1 dimension. Includes documentation and tests.
I'd like to support higher-dimensional inputs, but I spent a while trying to figure out how to dynamically allocate a new tuple at runtime for the output shape with little success (the number of dimensions needs to be equal to
max(len(reps), a.ndim)
. It seems like the only option iscontext.make_tuple
using thelower_builtin
API, but that didn't seem like a great idea. A possible workaround is using a list/array for the shape, but unfortunately that's not yet supported bynp.reshape
orarray.reshape
.Fixes #2327
Fixes #3456