You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
However I would love to implement implicit conversion so I could define pybind wrappers for functions like:
using extentsN = std::extents<size_t, std::dynamic_extent>;
void compute(std::mdspan<const float, extentsNx3> data_in, std::mdspan<float, extentsN> data_out);
PYBIND11_MODULE(pymdspan, m) {
m.def("compute", compute);
};
Questions:
Maybe the conversions should be from pybind11::buffer not to require numpy.h ?
Which pybind11 conversion is a good start to look at, maybe std::vector or Eigen::Tensor?
If the mdspan should be returned from a function, which abstraction to prefer?
I'm really not sure where to start . But I think it should be easier than Eigen::Tensor because it is always a non-owning view.
So, please, if you could give me some pointers and suggestions.
Known issues:
mdspan can handle strides, but I did not implement them yet nor I do check for them in py::array
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
-
I have made a demo for explicit conversion of pybind11::array to std::mdspan.
However I would love to implement implicit conversion so I could define pybind wrappers for functions like:
Questions:
I'm really not sure where to start . But I think it should be easier than Eigen::Tensor because it is always a non-owning view.
So, please, if you could give me some pointers and suggestions.
Known issues:
Beta Was this translation helpful? Give feedback.
All reactions