mirror of
https://github.com/ml-explore/mlx.git
synced 2025-06-24 17:31:16 +08:00
Fill vector with constructor instead of fill_n (#1113)
This commit is contained in:
parent
5be5daa6ef
commit
1a7ed5dcb6
@ -2854,7 +2854,7 @@ void init_ops(nb::module_& m) {
|
|||||||
if (strides) {
|
if (strides) {
|
||||||
a_strides = *strides;
|
a_strides = *strides;
|
||||||
} else {
|
} else {
|
||||||
std::fill_n(std::back_inserter(a_strides), a_shape.size(), 1);
|
a_strides = std::vector<size_t>(a_shape.size(), 1);
|
||||||
for (int i = a_shape.size() - 1; i > 0; i--) {
|
for (int i = a_shape.size() - 1; i > 0; i--) {
|
||||||
a_strides[i - 1] = a_shape[i] * a_strides[i];
|
a_strides[i - 1] = a_shape[i] * a_strides[i];
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user