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

Method test_tree_map

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

Source from the content-addressed store, hash-verified

10
11class TestTreeUtils(mlx_tests.MLXTestCase):
12 def test_tree_map(self):
13 tree = {"a": 0, "b": 1, "c": 2}
14 tree = mlx.utils.tree_map(lambda x: x + 1, tree)
15
16 expected_tree = {"a": 1, "b": 2, "c": 3}
17 self.assertEqual(tree, expected_tree)
18
19 def test_tree_flatten(self):
20 tree = [{"a": 1, "b": 2}, "c"]

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected