mlx.utils.tree_unflatten

mlx.utils.tree_unflatten#

tree_unflatten(tree: List[Tuple[str, Any]]) Any#

将 Python 树从其扁平化表示形式重新创建出来。

from mlx.utils import tree_unflatten

d = tree_unflatten([("hello.world", 42)])
print(d)
# {"hello": {"world": 42}}
参数

tree (list[tuple[str, Any]]) – Python 树的扁平化表示形式。例如,由 tree_flatten() 返回的结果。

返回值

一个 Python 树。