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
I am attempting to pass a float16 ndarray from Python to C++ using pybind11. While the compilation succeeds, running the Python code results in an error regarding an undefined symbol. Below are the relevant code snippets and environment details.
#include<iostream>
#include<stdfloat>
#include<pybind11/pybind11.h>
#include<pybind11/numpy.h>namespacepy= pybind11;
voidcheck_array(py::array_t<std::float16_t> arr) {
auto r = arr.unchecked<1>(); // Read-only access to NumPy arrayfor (ssize_t i = 0; i < r.shape(0); ++i) {
std::cout << "Element " << i << " has a size of " << sizeof(r(i)) << " bytes." << std::endl;
}
}
PYBIND11_MODULE(check_dtype, m) {
m.def("check_array", &check_array, "A function to check the byte size of array elements.");
}
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
-
I am attempting to pass a
float16
ndarray from Python to C++ using pybind11. While the compilation succeeds, running the Python code results in an error regarding an undefined symbol. Below are the relevant code snippets and environment details.Error Message:
C++ Code:
Python Code:
Environment:
Has anyone encountered this issue before or has insights on how to resolve the undefined symbol error? Any help would be greatly appreciated!
Beta Was this translation helpful? Give feedback.
All reactions