BaseReplayBuffer

class maze.train.trainers.common.replay_buffer.replay_buffer.BaseReplayBuffer

Abstract interface for all replay buffer implementations.

abstract add_rollout(actor_rollout: Union[maze.core.trajectory_recording.records.trajectory_record.SpacesTrajectoryRecord, maze.core.trajectory_recording.records.structured_spaces_record.StructuredSpacesRecord, numpy.ndarray, List])None

Add an actor rollout to the buffer.

Parameters

actor_rollout – A single actor rollout consisting of n_rollout_steps transitions.

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