Skip to content

Fix build error caused by upstream xtensor change (in xtensor master) #209

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 2 commits into from
Dec 9, 2019

Conversation

yungyuc
Copy link
Contributor

@yungyuc yungyuc commented Oct 4, 2019

The upstream change broke the build: xtensor-stack/xtensor@da7de15

Add pycontainer::is_contiguous to make xtensor happy.

The upstream change broke the build: xtensor-stack/xtensor@da7de15

Add pycontainer::is_contiguous to make xtensor happy.
@yungyuc
Copy link
Contributor Author

yungyuc commented Oct 9, 2019

Hello, I wonder if anyone has time to take a look at the fix?

@JohanMabille
Copy link
Member

Hi,

Sorry for the late reply. I think you also need to check that the first (if column_major) or last (if row_major) stride is 1, because we can have dynamic row_major layout for a view taking one element out of two for instance.

For row-major (c contiguous), make sure the last stride is unity. For colunm-major (fortran contiguous), make sure the first stride is unity.
{
if (PyArray_CHKFLAGS(python_array(), NPY_ARRAY_C_CONTIGUOUS))
{
return 1 == this->strides().back();
Copy link
Contributor Author

@yungyuc yungyuc Oct 9, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I assume this->strides() cannot be empty, and the element cannot be 0.

@yungyuc
Copy link
Contributor Author

yungyuc commented Oct 9, 2019

@JohanMabille thanks a lot for the comments (it's not at all late). I am not yet familiar with the xtensor/xtensor-python API, so this hot fix is far from comprehensive. Your help is very much needed.

@yungyuc
Copy link
Contributor Author

yungyuc commented Oct 16, 2019

@JohanMabille Is there something that I can improve in the PR?

@JohanMabille
Copy link
Member

I think the strides should not be considered as non empty.
Adding a test that passes a 0D array to a function expecting a pyarray object could confirm that.

@JohanMabille JohanMabille merged commit 0d004f3 into xtensor-stack:master Dec 9, 2019
@yungyuc yungyuc mentioned this pull request Dec 9, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants