For the complete documentation index, see llms.txt. Markdown versions of all pages are available by appending .md to any URL (e.g. /get-started.md).
Python class
TreeDef
TreeDef
class max.experimental.tree_utils.TreeDef(kind, children=(), keys=(), meta=None)
Bases: object
The shape of a tree, with its leaves abstracted away.
Equal structures rebuild each other’s leaves. Hashing skips the payloads.
child_keys
keys, or positions if empty.
-
Type:
-
The key of each child
children
The structure of each child, in leaf order.
keys
One key per child, or empty when the children are positional.
kind
kind: str
"leaf" (a leaf slot), "static" (a
value carried as-is in meta), "ref" (a repeat of an earlier
value), or one of the container tags "list", "tuple",
"namedtuple", "dict" and "node".
-
Type:
-
What this position holds
leaf_paths
The dotted path to each leaf, in leaf order.
meta
meta: Any = None
the value itself for "static",
the referenced slot number for "ref", the concrete type for
"namedtuple", and a (type, metadata) pair for "node".
-
Type:
-
Whatever the kind needs to rebuild
num_leaves
property num_leaves: int
The number of leaf slots in this structure; a "ref" counts none.