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

Function tree_unflatten

python/src/trees.cpp:251–262  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

249}
250
251nb::object tree_unflatten(
252 nb::object tree,
253 const std::vector<mx::array>& values,
254 int index /* = 0 */) {
255 return tree_map(tree, [&](nb::handle obj) {
256 if (nb::isinstance<mx::array>(obj)) {
257 return nb::cast(values[index++]);
258 } else {
259 return nb::cast<nb::object>(obj);
260 }
261 });
262}
263
264nb::object structure_sentinel() {
265 static nb::object sentinel;

Callers 3

py_value_and_gradFunction · 0.70
py_vmapFunction · 0.70
call_implMethod · 0.70

Calls 1

tree_mapFunction · 0.70

Tested by

no test coverage detected