BatchState

Contents

BatchState#

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

The batch state, which is used to store the batch data in the program.

This class extends LongTermState and is specifically designed to represent and manage batch data within a program. It provides a way to encapsulate batch-related information and associated metadata, facilitating operations like batch processing in machine learning or data analysis tasks.

Inherits all attributes from :class:`LongTermState`.

Note

This class does not introduce new methods or attributes beyond those inherited from LongTermState. Its primary purpose is to semantically distinguish batch states from other types of long-term states in the program.

Example

>>> batch_data = BatchState(np.array([1, 2, 3, 4, 5]), name="current_batch")
>>> batch_labels = BatchState(np.array([0, 1, 0, 1, 1]), name="batch_labels")