Skip to content

ReplayBufferFactory ​

Factory for creating replay buffers based on their configuration.

Source

Methods ​

create ​

python
create(config: ReplayBufferConfiguration, observation_shape: tuple[int, ...], observation_dtype: np.dtype) -> ReplayBuffer

Create a replay buffer from the given configuration.

Parameters:

  • config (ReplayBufferConfiguration) – The replay buffer configuration.
  • observation_shape (tuple[int, ...]) – The shape of the observations.
  • observation_dtype (dtype) – The numpy dtype for storing observations.

Returns:

  • ReplayBuffer – The created replay buffer.

Source

estimate_memory_usage ​

python
estimate_memory_usage(config: ReplayBufferConfiguration, observation_shape: tuple[int, ...], observation_dtype: np.dtype, is_per: bool = False) -> int

Estimate the memory usage of a replay buffer in bytes.

Parameters:

  • config (ReplayBufferConfiguration) – The replay buffer configuration.
  • observation_shape (tuple[int, ...]) – The shape of the observations.
  • observation_dtype (dtype) – The numpy dtype for storing observations.
  • is_per (bool) – Whether this is a Prioritized Experience Replay buffer.

Returns:

  • int – Estimated memory usage in bytes.

Source