Skip to main content

LeafSpec

The spec of a single leaf: TreeSpec(*).

:func:~clika_runtime.pytree.tree_flatten returns an instance of this class when the tree is a leaf, so isinstance(spec, LeafSpec) tells a lone value from a container.

pytree.tree_structure(3) TreeSpec(*) isinstance(pytree.tree_structure(3), pytree.LeafSpec) True

__init__​

__init__(self, *, none_is_leaf: 'bool' = True, namespace: 'str' = '') -> 'None'

Initialize self. See help(type(self)) for accurate signature.