Replies: 1 comment
-
What worked for me is a signature like Then you can access the inner arrays like
If you just need a 2D np array then your type should be |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
With numpy, I can create a 2D array of arrays, where each entry has a unique length:
Is it possible to create such a thing in pybind11? When I try to create
py::array_t<py::array_t<int>>
, I get:static assertion failed: Attempt to use a non-POD or unimplemented POD type as a numpy dtype
which makes it appear that
py::array
can't handle non-POD objects likepy::array
as a type, unless there's a way to specify it that I'm missing. The documentation also appears to imply this, but I'd like to confirm I'm understanding the limitation before resorting to an alternative design.The specific application is deep image data: a 2D array of pixels, where each pixel is an array of samples, in case there's a better way of achieving that. A numpy array of lists would suffice, but presumably that has the same problem. The alternative of a list of lists of lists/arrays is less desirable.
Beta Was this translation helpful? Give feedback.
All reactions