Repository navigation
Replies: 1 comment
|
I do something somewhat similar in boost-histogram. Here's an assisted answer: 🤖 AI text below 🤖 Set a PYBIND11_NUMPY_DTYPE(A, x, y); // must come before the dtype lookup below
py::class_<A>(m, "A")
.def(py::init<int, double>(), "x"_a, "y"_a)
.attr("dtype") = py::dtype::of<A>();Then boost-histogram does not do this exactly. In |
Uh oh!
There was an error while loading. Please reload this page.
Following instructions on https://pybind11.readthedocs.io/en/stable/advanced/pycpp/numpy.html#structured-types , I write some examples codes:
It works if I write codes like these:
But what I really want is that Numpy can recognize
Aas a valid structure dtype (not Python Object), e.g.:Is this possible?
All reactions