Add Array API support to sliding_win_oneaxis#211
Draft
cboulay wants to merge 2 commits intodeprecate_generatorfrom
Draft
Add Array API support to sliding_win_oneaxis#211cboulay wants to merge 2 commits intodeprecate_generatorfrom
cboulay wants to merge 2 commits intodeprecate_generatorfrom
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
There's a very small performance hit when in numpy (a couple hasattr checks), and actually mlx is significantly slower because it doesn't have strides and therefore makes multiple copies of the data. Despite that, allowing the matrix to stay in mlx through windowing has huge gains for subsequent processing.
I think I can improve upon this further. Previously, I was relying on the fact that manipulating the strides creates a simple view on the data, so I could make a 1-sample-step array then simply index it with
::step_sizewith no data copies.However, with non-strided array APIs, the 1-sample-step array is expensive. I think the non-strided code path should skip the 1-sample-step intermediate and copy only the data required in the output.
Converting this to draft while I work on that...