LongTermState

Contents

LongTermState#

class brainstate.LongTermState(value, name=None, **metadata)#

The long-term state, which is used to store the long-term data in the program.

This class extends the base State class and is specifically designed to represent and manage long-term data within a program. Long-term states are typically used for data that persists across multiple iterations or epochs of a process.

For example, in a training process, the weights of the model are considered long-term states as they are updated and maintained throughout the entire training procedure.

Inherits all attributes from the base :class:`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 long-term states from other types of states in the program.

Example

>>> model_weights = LongTermState(np.random.randn(100, 100), name="model_weights")
>>> optimizer_state = LongTermState({}, name="optimizer_state")