Skip to content

Commit

Permalink
step 2: make sure we can create a NumPy array through pybind11
Browse files Browse the repository at this point in the history
  • Loading branch information
jpivarski committed Sep 30, 2024
1 parent edfb65e commit 9ec5c2a
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion header-only/examples/pybind11/demo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,11 @@ py::object snapshot_builder(const T &builder) {
std::map<std::string, void*> cpp_container;
for (auto name_nbytes : names_nbytes) {
int nbytes = name_nbytes.second;
std::cout << "nbytes = " << nbytes << std::endl;

py::object array = np.attr("empty")(nbytes, dtype_u1);

py::module::import("builtins").attr("print")(array);

}


Expand Down

0 comments on commit 9ec5c2a

Please sign in to comment.