Skip to content

TransitionAccumulator ​

python
TransitionAccumulator(batch_add_size: int) -> None

Buffers emitted n-step transitions and emits replay-ready batches.

Initialize the transition accumulator.

Parameters:

  • batch_add_size (int) – Number of staged transitions required before automatic flush.

Source

Properties ​

buffered_count ​

python
buffered_count: int

Get the number of transitions currently staged.

Returns:

  • int – The number of buffered transitions.

Source

Methods ​

extend ​

python
extend(transitions: Iterable[BufferedTransition]) -> ReplayBatch | None

Stage transitions and emit a replay batch once the configured batch size is reached.

Parameters:

  • transitions (Iterable[BufferedTransition]) – Transitions emitted from one or more n-step buffers.

Returns:

  • ReplayBatch | None – A replay batch when the local buffer reaches the configured size, otherwise None.

Source

flush ​

python
flush() -> ReplayBatch | None

Flush all staged transitions into one replay batch.

Returns:

  • ReplayBatch | None – A replay batch containing all staged transitions, or None if the buffer is empty.

Source