| 297 | } |
| 298 | |
| 299 | nb::object tree_unflatten_from_structure( |
| 300 | nb::object structure, |
| 301 | const std::vector<mx::array>& values, |
| 302 | int index /* = 0 */) { |
| 303 | auto sentinel = structure_sentinel(); |
| 304 | return tree_map(structure, [&](nb::handle obj) { |
| 305 | if (obj.is(sentinel)) { |
| 306 | return nb::cast(values[index++]); |
| 307 | } else { |
| 308 | return nb::cast<nb::object>(obj); |
| 309 | } |
| 310 | }); |
| 311 | } |
no test coverage detected