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
Fix ravel
for strides 0
#5978
Fix ravel
for strides 0
#5978
Conversation
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 suppose we only have to call _core._internal_ascontiguousarray
(after reshape) to fix the issue.
if order_char == b'A': | ||
if self._f_contiguous and not self._c_contiguous: | ||
order_char = b'F' | ||
else: | ||
order_char = b'C' | ||
if order_char == b'C': | ||
return _reshape(self, shape) | ||
return _reshape(self, shape, enforce_copy) |
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.
The input is copied only if it's required. Maybe it should have been tested that
>>> x = xp.ones((2, 3)); x.ravel().base is x
True
yes, |
Review comments done! |
seems like i rebased something that i shouldn't, will fix |
Should be ok now! PTAL :) |
Co-authored-by: Toshiki Kataoka <tos.lunar@gmail.com>
Co-authored-by: Toshiki Kataoka <tos.lunar@gmail.com>
makes sense, thanks!! |
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.
LGTM
pfnCI, test this please. |
Jenkins CI test (for commit 93cfba6, target branch master) succeeded! |
Fix `ravel` for strides 0
Always enforce the copy if the array is neither c- or f-contiguous.
Closes #5972