-
Notifications
You must be signed in to change notification settings - Fork 68
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
Reshaping mdspans #354
Comments
No there is not. |
@dalg24 Thank you for the details. In the above example Is it possible to have a generic reshape layout which wraps the input layout and applies the reshape mapping? It might not be optimal in terms of performance but might just work for most cases. |
You might be able to add a custom layout mapping that applies the reshape operations. One thing is that you would pay the cost of your reshaping calculations each access as mdspan uses the mapping to calculate the offset into the underlying buffer. One intriguing possibility is that if we have something like the mdspan copy proposal I'm working on in the standard, you could combine the two to create a reshape function that copies. It wouldn't be semantically the same as numpy reshape, since mdspans don't own memory, but could end up with something like |
Yes, I will give that a try. The custom layout mapping might solve my use case. |
It sounds like the original issue is resolved, so I'm closing this issue. Please feel free to reopen or to create another issue if you have further concerns. Thanks! |
Is there a way of reshaping a mdspan?
I'm looking for the equivalent of the following numpy code:
Does the proposal support that? Its one of the basic functionalities of numpy/pytorch and it would be great if that could be supported in mdspan too.
The text was updated successfully, but these errors were encountered: