StaticBuffer#

class hybrid_aif.train.StaticBuffer[source]#

Bases: Module

A uniform replay buffer of fixed-length episode-aligned sequences. A pytree.

One JAX array per column, written FIFO into a ring. size and cursor are traced scalars, so add() and sample() are pure and the buffer can ride a lax.scan carry.

data: Episode#

The stored sequences, one array per column, (capacity, seq_len, ...).

size: Array#

The number of live slots (traced).

cursor: Array#

The next slot to write (traced).

capacity: int#

The number of sequences held.

seq_len: int#

The steps per sequence.

schema: tuple[tuple[str, ColumnSpec], ...] = ()#

The task’s own columns, (name, ColumnSpec) pairs.

property pad_rules: dict[str, str]#

How fit_length() pads each task column, from the schema.

classmethod empty(capacity, seq_len, obs_dim, action_dim, extras=None)[source]#

An allocated, empty buffer. Shapes are fixed here and never change.

extras declares the task’s columns (ColumnSpec per name); every episode written must carry exactly those.

ready(batch_size)[source]#

Whether a full batch can be drawn without repeating the whole buffer. Host-side.

__init__(data, size, cursor, capacity, seq_len, schema=())#