Closed
Description
Hi,
I have a trouble when using boost 1.64.0 to convert a vector to a 2D ndarray.
I try to use code like this
np::ndarray pyArray = np::from_data(vec.data(), np::dtype::get_builtin<float>(), np::tuple(rows, cols), py::make_tuple(cols, 1), py::object() );
when I return it to python the result is not same as C++. Then I change this to another way which is
np::ndarray result = np::zeros(np::tuple(rows, cols), np::dtype::get_builtin<float>());
std::copy(vec.begin(), vec.end(), reinterpret_cast<float*>(result.get_data()));
and it is works correctly now.
I am not sure it is a bug or I use the from_data() in a wrong way.
Thanks a lot for your help!
Metadata
Metadata
Assignees
Labels
No labels