Skip to content

StorageBackedReplayBuffer ​

python
StorageBackedReplayBuffer(capacity: int, observation_shape: tuple[int, ...], observation_dtype: np.dtype) -> None

Intermediate base for replay buffers backed by a TransitionStorage.

Owns the storage and its lock, exposes the storage columns as pass-through properties, and provides the shared row copy that sample_into implementations use to fill the caller-provided output arrays. Sampling policy (uniform vs prioritized) stays in subclasses.

Initialize the storage-backed buffer.

Parameters:

  • capacity (int) – Maximum number of transitions to store.
  • observation_shape (tuple[int, ...]) – Shape of the observations.
  • observation_dtype (dtype) – The numpy dtype for storing observations.

Source

Properties ​

actions ​

python
actions: np.ndarray

Get the stored actions column.

Source

capacity ​

python
capacity: int

Get the buffer's maximum number of stored transitions.

Source

dones ​

python
dones: np.ndarray

Get the stored done-flags column.

Source

idx ​

python
idx: int

Get the next circular-buffer write position.

Source

n_steps ​

python
n_steps: np.ndarray

Get the stored n-step-count column.

Source

next_states ​

python
next_states: np.ndarray

Get the stored next-states column.

Source

observation_dtype ​

python
observation_dtype: np.dtype

Get the numpy dtype used for stored observations.

Source

observation_shape ​

python
observation_shape: tuple[int, ...]

Get the shape of observations stored in the buffer.

Returns:

  • tuple[int, ...] – The observation shape tuple.

Source

reward_shaping_metadata_spec ​

python
reward_shaping_metadata_spec: dict[str, np.dtype]

Get the reward-shaping metadata columns stored in the buffer.

Returns:

  • dict[str, dtype] – A mapping of metadata key to numpy dtype.

Source

rewards ​

python
rewards: np.ndarray

Get the stored rewards column.

Source

size ​

python
size: int

Get the current number of stored transitions.

Source

states ​

python
states: np.ndarray

Get the stored states column.

Source

Methods ​

__len__ ​

python
__len__() -> int

Get the current number of transitions in the buffer.

Returns:

  • int – The current size of the buffer.

Source

Values ​

lock ​

python
lock = threading.Lock()

Source