ShortTermState#
- class brainstate.ShortTermState(value, name=None, **metadata)#
A class representing short-term state in a program.
ShortTermStateis used to store temporary or transient data that is only relevant for a short duration within the program’s execution. This class extends the base State class, inheriting its properties and methods while specifically denoting the short-term nature of the stored data.For example, in a machine learning training process, the gradients of the model would typically be represented as
ShortTermState, as they are computed and used within each iteration but not necessarily preserved across iterations.- Inherits all attributes from the base State class.
Note
This class does not introduce new methods or attributes beyond those inherited from the State class. Its primary purpose is to semantically distinguish short-term states from other types of states in the program.
Example
>>> gradient = ShortTermState(np.zeros(100), name="model_gradient") >>> intermediate_result = ShortTermState({}, name="layer_activations")