IMPORTANT: To view this page as Markdown, append `.md` to the URL (e.g. /get-started.md). For the complete documentation index, see llms.txt.
Skip to main content
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

extend_path

extend_path()

max.experimental.tree_utils.extend_path(path, key)

source

Extends a dotted path by one key.

An empty key adds no segment, and the root takes no leading dot:

from max.experimental import tree_utils as tree

assert tree.extend_path("blocks.3", "bias") == "blocks.3.bias"
assert tree.extend_path("", "blocks") == "blocks"
assert tree.extend_path("blocks.3", "") == "blocks.3"

Parameters:

  • path (str) – The path so far, or "" at the root.
  • key (Any) – This position’s key, rendered with str().

Returns:

The extended path.

Return type:

str