PyTreeSpec Constructor API
The optree.treespec namespace contains constructors for class optree.PyTreeSpec.
>>> import optree.treespec as treespec
>>> treespec.leaf()
PyTreeSpec(*)
>>> treespec.none()
PyTreeSpec(None)
>>> treespec.dict({'a': treespec.leaf(), 'b': treespec.leaf()})
PyTreeSpec({'a': *, 'b': *})
Added in version 0.14.1.
Check section PyTreeSpec Functions for more detailed documentation.
|
Make a treespec representing a leaf node. |
|
Make a treespec representing a |
|
Make a treespec representing a |
|
Make a treespec representing a |
|
Make a treespec representing a |
|
Make a treespec representing a namedtuple node from a namedtuple of child treespecs. |
|
Make a treespec representing an |
|
Make a treespec representing a |
|
Make a treespec representing a |
|
Make a treespec representing a PyStructSequence node from a PyStructSequence of child treespecs. |
|
Make a treespec from a collection of child treespecs. |