diff --git a/python/src/ops.cpp b/python/src/ops.cpp index 009b1dace..29ca8ed86 100644 --- a/python/src/ops.cpp +++ b/python/src/ops.cpp @@ -2854,7 +2854,7 @@ void init_ops(nb::module_& m) { if (strides) { a_strides = *strides; } else { - std::fill_n(std::back_inserter(a_strides), a_shape.size(), 1); + a_strides = std::vector(a_shape.size(), 1); for (int i = a_shape.size() - 1; i > 0; i--) { a_strides[i - 1] = a_shape[i] * a_strides[i]; }