BaseReplayBuffer¶
-
class
maze.train.trainers.common.replay_buffer.replay_buffer.
BaseReplayBuffer
¶ Abstract interface for all replay buffer implementations.
-
abstract
add_rollout
(rollout: Union[maze.core.trajectory_recording.records.trajectory_record.SpacesTrajectoryRecord, List[maze.core.trajectory_recording.records.structured_spaces_record.StructuredSpacesRecord]]) → None¶ Add an actor rollout to the buffer.
- Parameters
rollout – A single actor rollout consisting of n_rollout_steps transitions.
-
abstract
add_transition
(transition: Union[maze.core.trajectory_recording.records.structured_spaces_record.StructuredSpacesRecord, maze.core.trajectory_recording.records.trajectory_record.SpacesTrajectoryRecord]) → None¶ Add a single transition (rollout length == 1) to the buffer.
- Parameters
transition – The actor transition to be added to the buffer.
-
abstract
sample_batch
(n_samples: int, learner_device: str) → List[Union[maze.core.trajectory_recording.records.structured_spaces_record.StructuredSpacesRecord, maze.core.trajectory_recording.records.trajectory_record.SpacesTrajectoryRecord]]¶ Sample mini-batch randomly from the buffer.
- Parameters
n_samples – The number of samples to draw.
learner_device – The device of the learner (cpu or cuda).
- Returns
A sample batch of trajectory or spaces records
-
abstract