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

Function validate_subtrees

python/src/trees.cpp:6–15  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

4
5template <typename T, typename U, typename V>
6void validate_subtrees(const std::vector<nb::object>& subtrees) {
7 int len = nb::cast<T>(subtrees[0]).size();
8 for (auto& subtree : subtrees) {
9 if ((nb::isinstance<T>(subtree) && nb::cast<T>(subtree).size() != len) ||
10 nb::isinstance<U>(subtree) || nb::isinstance<V>(subtree)) {
11 throw std::invalid_argument(
12 "[tree_map] Additional input tree is not a valid prefix of the first tree.");
13 }
14 }
15}
16
17nb::object tree_map(
18 const std::vector<nb::object>& trees,

Callers

nothing calls this directly

Calls 1

sizeMethod · 0.45

Tested by

no test coverage detected