xtensor-python icon indicating copy to clipboard operation
xtensor-python copied to clipboard

Add support for xtensor_fixed

Open PerretB opened this issue 7 years ago • 2 comments

Hi,

currently xtensor python brings seamless integration of xarray and xtensor types with numpy. However xtensor_fixed type is not supported. Hence the following definitions work (with m an instance of pybind11::module):

m.def("test_xarray", [](){return xt::xarray<int>{1,2};});
m.def("test_xtensor", [](){return xt::xtensor<int, 1>{1,2};});

while this one fails

m.def("test_xtensor_fixed", [](){return xt::xtensor_fixed <int, xt::xshape<2>>{1,2};});

at runtime. When trying to call the method from python, the following error is reported:

TypeError: Unable to convert function return value to a Python type! The signature was
() -> xt::xfixed_container<int, xt::fixed_shape<2ul>, (xt::layout_type)1, xt::xtensor_expression_tag>

Would it be possible to add seamless integration with xtensor_fixed ?

PerretB avatar Sep 03 '18 15:09 PerretB

This would be a very welcome addition!

robertodr avatar Nov 07 '19 13:11 robertodr

This would be a really nice thing to have! xtensor_fixed is a fundamental datatype and the absence of this feature is going to cause me to have to rewrite a lot of code that I expected to easily use from python...

TheButlah avatar Jan 30 '20 20:01 TheButlah