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 function
map
map()
max.experimental.tree_utils.map(f, tree, *rest, leaf=None, shared=False)
Builds a new tree with each leaf replaced by what f returns.
With extra trees in rest, f receives one leaf from each.
-
Parameters:
-
- f (Callable[[...], Any]) – Applied to one leaf from
treeand one from each ofrest. - tree (Any) – The structure whose leaves are mapped.
- rest (Any) – More trees, each with
tree’s structure. - leaf (type | tuple[type, ...] | Callable[[Any], bool] | None) – Where the walk stops.
- shared (bool) – Whether an aliased value is one leaf or one per path. Set,
fruns once per distinct leaf andrestmust alias in the same places.
- f (Callable[[...], Any]) – Applied to one leaf from
-
Returns:
-
A new tree with
tree’s structure, holding the mapped leaves. -
Raises:
-
ValueError – If a tree in
restdoes not matchtree’s structure. -
Return type: