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

Method test_tree_flatten

python/tests/test_tree.py:19–24  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

17 self.assertEqual(tree, expected_tree)
18
19 def test_tree_flatten(self):
20 tree = [{"a": 1, "b": 2}, "c"]
21 vals = (1, 2, "c")
22 flat_tree = mlx.utils.tree_flatten(tree)
23 self.assertEqual(list(zip(*flat_tree))[1], vals)
24 self.assertEqual(mlx.utils.tree_unflatten(flat_tree), tree)
25
26 def test_merge(self):
27 t1 = {"a": 0}

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected