File tree Expand file tree Collapse file tree 2 files changed +2
-9
lines changed
subprojects/robotpy-cscore/cscore/cvnp Expand file tree Collapse file tree 2 files changed +2
-9
lines changed Original file line number Diff line number Diff line change @@ -181,15 +181,7 @@ namespace cvnp
181181
182182 bool is_array_contiguous (const pybind11::array& a)
183183 {
184- pybind11::ssize_t expected_stride = a.itemsize ();
185- for (int i = a.ndim () - 1 ; i >=0 ; --i)
186- {
187- pybind11::ssize_t current_stride = a.strides ()[i];
188- if (current_stride != expected_stride)
189- return false ;
190- expected_stride = expected_stride * a.shape ()[i];
191- }
192- return true ;
184+ return a.flags () & pybind11::array::c_style;
193185 }
194186
195187
Original file line number Diff line number Diff line change @@ -49,6 +49,7 @@ namespace cvnp
4949 return pybind11::array (
5050 pybind11::dtype::of<_Tp>()
5151 , std::vector<std::size_t > {_rows, _cols}
52+ , std::vector<std::size_t >{_cols * sizeof (_Tp), sizeof (_Tp)} // Strides
5253 , m.val
5354 );
5455 }
You can’t perform that action at this time.
0 commit comments