MCPcopy Create free account
hub / github.com/ml-explore/mlx / fill_vector

Function fill_vector

python/src/convert.cpp:262–272  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

260
261template <typename T, typename U>
262void fill_vector(T list, std::vector<U>& vals) {
263 for (auto l : list) {
264 if (nb::isinstance<nb::list>(l)) {
265 fill_vector(nb::cast<nb::list>(l), vals);
266 } else if (nb::isinstance<nb::tuple>(*list.begin())) {
267 fill_vector(nb::cast<nb::tuple>(l), vals);
268 } else {
269 vals.push_back(nb::cast<U>(l));
270 }
271 }
272}
273
274template <typename T>
275PyScalarT validate_shape(

Callers 1

array_from_list_implFunction · 0.85

Calls 2

push_backMethod · 0.80
beginMethod · 0.45

Tested by

no test coverage detected