Implementation of permute_dims function#786
Closed
vlad-perevezentsev wants to merge 2 commits intoIntelPython:masterfrom
Closed
Implementation of permute_dims function#786vlad-perevezentsev wants to merge 2 commits intoIntelPython:masterfrom
vlad-perevezentsev wants to merge 2 commits intoIntelPython:masterfrom
Conversation
Collaborator
|
|
||
|
|
||
| def permute_dims(X, axes): | ||
| if type(X) is not dpt.usm_ndarray: |
Contributor
There was a problem hiding this comment.
Suggested change
| if type(X) is not dpt.usm_ndarray: | |
| if not isinstance(X, dpt.usm_ndarray): |
ae95685 to
1c8970d
Compare
|
|
||
| def permute_dims(X, axes): | ||
| """ | ||
| permute_dims(X: usm_ndarray, axes: tuple or list) -> usm_ndarray |
Contributor
There was a problem hiding this comment.
Since your branch does not build documentation we do not see how this comes out in docs. Please create a branch in the main repo and push there to see the rendered docs,
| "The length of the passed axes does not match " | ||
| "to the number of usm_ndarray dimensions." | ||
| ) | ||
| if axes not in permutations(range(0, X.ndim), X.ndim): |
Contributor
There was a problem hiding this comment.
This has horrible computational and space complexity in the dimensionality of the array d, specifically O(d!).
More efficient way:
- Length of the tuple must be
d - Minimum element must be
0, maximumd-1. - Array should have no duplicates.
1c8970d to
aefab1d
Compare
aefab1d to
30e98fe
Compare
Collaborator
Author
|
Moved to #787 |
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.
This PR adds
permute_dimsfunctions according to Python array API standard forusm_ndarray