cottax.pytree.consumers.surface.names module¶
The pytree place’s names: a node name and a place from each other’s keys, and a key one deeper (PytreeDerivedNames), what a path written in full means (WrittenKeys), and what a bare string means, a jax key under a root (Under) or nothing, every place written in full (InFull).
- class PytreeDerivedNames[source]¶
Bases:
DerivedNames[NodePath,VarPath]A node name and a place give each other their keys; a name one deeper is a string key; a model tree is read by key path.
- beside(place: VarPath, name: str)[source]¶
place one name deeper: where a read written as a value sits, under its purpose.
- Return type:
- node_at(place: VarPath)[source]¶
The node name a place gives: where a closure over it binds.
- Return type:
- class WrittenKeys[source]¶
Bases:
Written[NodePath,VarPath]A path written in full: a V path the place it builds, an N path the node name.
- places(written: Keys)[source]¶
The places written stands for; None where it is no place.
- Return type:
tuple[VarPath,...] |None
- node(written: Keys, names: DerivedNames)[source]¶
The node name written takes, names the surface’s rules; None where it is no node name.
- Return type:
NodePath|None
- class PytreeLocator[source]¶
Bases:
Locator[VarPath,NodePath]What every pytree locator decides alike: a string where a node is due is a key at the root, as a slot in a mapping names one. What a string means where a place is due is each final’s.
- key_of(step: Step)[source]¶
The jax key a step down a model tree is: a field a GetAttrKey, a key a DictKey, an index a SequenceKey.
- Return type:
KeyEntry
- class Under(root: Var, key: type[GetAttrKey] | type[DictKey])[source]¶
Bases:
PytreeLocatorA place string one key under a root, the key a GetAttrKey or a DictKey.
- key: type[GetAttrKey] | type[DictKey]¶
- class InFull[source]¶
Bases:
PytreeLocatorNo place strings: every place written in full, a V path or a VarPath.