State#
- class braincore.State(value)#
The pointer to specify the dynamical data.
To implement a new subclass of
State, you only need to inherent this class:Example:
class MyState(State): pass
The typical examples of
Statesubclass are:ShortTermState: The short-term state, which is used to store the short-term data in the program.LongTermState: The long-term state, which is used to store the long-term data in the program.ParamState: The parameter state, which is used to store the parameters in the program.RandomState: The random generator state, which is used to store the random key in the program.
- Parameters:
value (
Any) – PyTree. It can be anything as a pyTree.
- property source_info: SourceInfo#
The source information of the state, can be useful to identify the source code where the definition of the state.
- Returns:
The source information.
- tree_flatten()[source]#
Flattens this variable.
- Returns:
A pair where the first element is a list of leaf values and the second element is a treedef representing the structure of the flattened tree.