xtensor-stack / xtensor-python

Python bindings for xtensor
BSD 3-Clause "New" or "Revised" License
347 stars 58 forks source link

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

Closed yungyuc closed 4 years ago

yungyuc commented 5 years ago

The upstream change broke the build: https://github.com/QuantStack/xtensor/commit/da7de15be73c396bc9ffb31fe8c630938c57ffe8

Add pycontainer::is_contiguous to make xtensor happy.

yungyuc commented 5 years ago

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

JohanMabille commented 5 years ago

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.

yungyuc commented 5 years ago

@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 commented 5 years ago

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

JohanMabille commented 5 years ago

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.