mirror of
https://github.com/ml-explore/mlx.git
synced 2025-12-16 01:49:05 +08:00
Zero-initilizing array
This commit is contained in:
@@ -58,7 +58,7 @@ inline std::array<T, MAX_NDIM> fixed_vector(const std::vector<T>& vec) {
|
|||||||
throw std::runtime_error(
|
throw std::runtime_error(
|
||||||
fmt::format("ndim can not be larger than {}.", MAX_NDIM));
|
fmt::format("ndim can not be larger than {}.", MAX_NDIM));
|
||||||
}
|
}
|
||||||
std::array<T, MAX_NDIM> result;
|
std::array<T, MAX_NDIM> result = {};
|
||||||
std::copy_n(vec.begin(), vec.size(), result.begin());
|
std::copy_n(vec.begin(), vec.size(), result.begin());
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user