-
This issue occurs when I tried to slice from 3d numpy array to 2d and then assign it to a C++ list. The result after slicing like np[:,:,1] is a discontinuous array (not in c or fortan order). I can't use std::copy(py::array.buf, my_continous_array_struct). |
Beta Was this translation helpful? Give feedback.
Answered by
kaixiongg
Nov 10, 2022
Replies: 1 comment 1 reply
-
I figured it out, we could call np.ascontiguousarray() inside pybind which enforce the array to be in c order(memory order). |
Beta Was this translation helpful? Give feedback.
1 reply
Answer selected by
kaixiongg
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I figured it out, we could call np.ascontiguousarray() inside pybind which enforce the array to be in c order(memory order).