Comments (7)
Thanks for reporting. This is definitely a bug in xtensor.
from xtensor-python.
Just FYI, I hit the exact same error message when I didn't have the Python headers included as system headers (i.e. -I
vs -isystem
). I think something in there is redefining or otherwise interfering with the size of builtin types, which would make sense re interfacing with Numpy. So this could be a build setup thing, I just fixed it in CMake myself.
from xtensor-python.
Hi @AntoinePrv, do you think that this issue is related to xtensor-stack/xtensor#2651, and so would be fixed by xtensor-stack/xtensor#2652 too, or is this an unrelated problem?
from xtensor-python.
@ThibHlln I could not reproduce this. Is this a compiler error? If so which one and on which platform?
I does not seem related to xtensor-stack/xtensor#2651 but perhaps since xtensor-stack/xtensor#2651 is a big refactor it could solve it. Do you have the time to try?
from xtensor-python.
Hi @AntoinePrv,
Yes, this is a compiler error I get with Clang on macOS, and also with MSVC on Windows (see error message below).
C:\Users\thallouin\micromamba\envs\pytensor-sandbox-env\Library\include\xtensor/xsort.hpp(463,38): error C2397: conversion from 'unsigned __int64' to '_Ty' requires a narrowing conversion [C:\Users\thallouin\CLionProjects\pytensor-sandbox\build\pytensor_sandbox.vcx
proj]
with
[
_Ty=ptrdiff_t
]
C:\Users\thallouin\micromamba\envs\pytensor-sandbox-env\Library\include\xtensor/xsort.hpp(508): message : see reference to function template instantiation 'R xt::partition<E,C,eval_type,int>(const xt::xexpression &,const C &,xt::placeholders::xtuph)' being compi
led [C:\Users\thallouin\CLionProjects\pytensor-sandbox\build\pytensor_sandbox.vcxproj]
with
[
R=eval_type,
E=xt::pytensor<double,2,xt::layout_type::dynamic>,
C=xt::xtensor_container<xt::uvector<size_t,std::allocator<size_t>>,1,xt::layout_type::row_major,xt::xtensor_expression_tag>,
D=xt::pytensor<double,2,xt::layout_type::dynamic>
]
So, I tried with your PR xtensor-stack/xtensor#2652, and even though it does not look like you touched the line the compiler is complaining about (i.e. https://github.com/xtensor-stack/xtensor/blob/master/include/xtensor/xsort.hpp#L463), I don't get the error anymore on Windows with MSVC (I will check on macOS with Clang later on), so maybe the type of the variable has changed and the narrowing conversion is not necessary anymore?
from xtensor-python.
Basically in xt::partition
(and other places), a tensor gets created with R::from_shape({ de.size() });
https://github.com/xtensor-stack/xtensor/blob/master/include/xtensor/xsort.hpp#L463
For xt::pytensor
size_type
is unsigned (derived from buffer_adaptor
), but shape_type
(the argument of from_shape
) is std::array<npy_intp, N>
hence the narrowing conversion.
A fix there would be simple enough but let's see if it is still present with xtensor-stack/xtensor#2652.
IMHO the real issue here, and in other bugs we've caught, is that xtensor functions are not tested consistently with all types of containers (let alone view, expressions). Tracking in xtensor-stack/xtensor#2658.
from xtensor-python.
OK, thank you for the explanation @AntoinePrv.
Even though my MWE provided above only failed with MSVC on Windows, in a more complex project, I had the same kind of failure with Clang on macOS. But once again, using xtensor-stack/xtensor#2652 fixed it, so I am looking forward to the PR merge now. :-)
from xtensor-python.
Related Issues (20)
- Bug in sort
- Enable load cast `xt::xtensor<...>`
- Error with strided view
- is:issue how to sum string type load from csv? and how to convert string column to timestamp? HOT 1
- The URL listed on the project's page is a broken link HOT 1
- Doesn't install the python binding HOT 4
- Tests fail to find Python.h HOT 6
- Segmentation fault of MSVC 19
- Broadcasting problem on basic operations? HOT 5
- Retrieving xt::pyarray when embedding python using pybind11 HOT 1
- Add support for nanobind? HOT 5
- Support for custom types? HOT 1
- Assignment of Expression to Tensor of Incorrect Dimensions - Strange Error - Numpy Unable to Allocate very Large Array HOT 4
- Build C++ XTensor project as Python package so users can `pip install` without any additional dependencies
- How to convert xt::pyarray to xt::xarray? HOT 1
- /home/mona/anaconda3/envs/zephyr/include/xtensor-python/pycontainer.hpp:30:10: fatal error: numpy/arrayobject.h: No such file or directory HOT 2
- Fix Windows CI
- xtensor cmake variables do not match variables in CMakeLists.txt
- Restore #296 when all python versions support it on conda-forge
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from xtensor-python.