garage.replay_buffer.path_buffer
¶
A replay buffer that efficiently stores and can sample whole paths.
- class PathBuffer(capacity_in_transitions, env_spec=None)¶
A replay buffer that stores and can sample whole episodes.
This buffer only stores valid steps, and doesn’t require paths to have a maximum length.
- Parameters
- property n_transitions_stored¶
Return the size of the replay buffer.
- Returns
Size of the current replay buffer.
- Return type
- add_episode_batch(episodes)¶
Add a EpisodeBatch to the buffer.
- Parameters
episodes (EpisodeBatch) – Episodes to add.
- add_path(path)¶
Add a path to the buffer.
- Parameters
path (dict) – A dict of array of shape (path_len, flat_dim).
- Raises
ValueError – If a key is missing from path or path has wrong shape.
- sample_path()¶
Sample a single path from the buffer.
- Returns
A dict of arrays of shape (path_len, flat_dim).
- Return type
path
- sample_transitions(batch_size)¶
Sample a batch of transitions from the buffer.
- sample_timesteps(batch_size)¶
Sample a batch of timesteps from the buffer.
- Parameters
batch_size (int) – Number of timesteps to sample.
- Returns
The batch of timesteps.
- Return type
- clear()¶
Clear buffer.