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'm new to C++ and Pybind11. Is it possible to initialize a multidimensional pybind array py::array_t with zeros? In C++, I can do float marr[10][10] = {};.
I'm creating a pybind array as follows. I can fill in zeros using nested for loops, but I'm wondering if there is a more efficient way.
size_t N = 3;
size_t M = 4;
py::array_t<float, py::array::c_style> arr({N, M});
// How to initialize arr with zeros?
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
Uh oh!
There was an error while loading. Please reload this page.
-
I'm new to C++ and Pybind11. Is it possible to initialize a multidimensional pybind array
py::array_t
with zeros? In C++, I can dofloat marr[10][10] = {};
.I'm creating a pybind array as follows. I can fill in zeros using nested for loops, but I'm wondering if there is a more efficient way.
Does pybind initialize with zeros automatically?
Beta Was this translation helpful? Give feedback.
All reactions