-
Notifications
You must be signed in to change notification settings - Fork 26
Align strides with numpy #2747
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
Merged
Merged
Align strides with numpy #2747
Changes from 14 commits
Commits
Show all changes
16 commits
Select commit
Hold shift + click to select a range
c109279
Cast strides from usm_ndarray to numpy-like strides of dpnp.ndarray
antonwolfy e882b21
Add strides casting to dpnp.ndarray constructor
antonwolfy 3938021
Update implementation of dpnp.diagonal with proper offset calculation
antonwolfy 2507fde
Update implementation of view() method
antonwolfy adc5b03
Update utils functions to bypass expected stride format to MKL functions
antonwolfy a248fe0
Update tests to align with new strides implementation
antonwolfy 6548326
Fix typo in FFT utils implementation
antonwolfy 0ebd959
Revert changes in test_astype_type since it failes with numpy.intc dtype
antonwolfy ab441b6
Fix a way how contig flags calculated for linalg utils
antonwolfy 3f78067
Add casting for input strides and none buffer
antonwolfy 95ab60e
Update test_copy_orders aligning dtypes of resulting arrays from nump…
antonwolfy d6ead2f
Update tests to work without fp64 support
antonwolfy 7adabb5
Add PR to the changelog
antonwolfy 89810df
Merge branch 'master' into align-strides-with-numpy
antonwolfy a759850
Keep legacy behavior for dpnp.diagonal when offset is outside the bounds
antonwolfy 5e48a21
Merge branch 'master' into align-strides-with-numpy
antonwolfy File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
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
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
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
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
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
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
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
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
Oops, something went wrong.
Oops, something went wrong.
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 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.
I think the logic here also needs to be updated because currently dpnp returns incorrect strides compared to NumPy. Could you also add a test to cover this case?
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.
It seems that wasn't aligned on the master as well:
Btw I will update the code to keep the same behavior as was on the master. But I wonder if there is a strict requirement on strides equality with NumPy for a 0-size array. In any case it'd be better to handle that (if needed) in the seprarte PR.
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.
@antonwolfy Thanks for bringing this distinction. Just curious to know if dpnp/dpctl recommends any particular numpy version dependency for testing. The app I was working with failed too with the
diagonalmethod in stacktrace.Would the below legacy behavior be restored, only when the offsets is outside the bounds and rest of the functionality to changed to number of bytes from number of items ?
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.
We are targeting to align with the latest published numpy version.
Could you please share an example of the code with failure? It might be some other issue we have to resolve.
Everywhere it will be to return the number of bytes.
In case when the offsets is outside the bounds, previously dpnp returns strides end with
...,1), and now it will end with..., 1 * a.itemsize).The "legacy" in that use case means "different from the numpy" for returned 0-sized array.