Skip to content

Prioritised Trajectory Buffer

Bases: TrajectoryBuffer[Experience, BufferState, BufferSample]

Pure functions defining the prioritised trajectory buffer. This buffer behaves like a trajectory buffer, however it also stores the priorities of the data subsequences in a sum tree.

Attributes:

Name Type Description
init

A pure function which may be used to initialise the buffer state using a single timestep (e.g. (s,a,r)).

add

A pure function for adding a new batch of experience to the buffer state.

sample

A pure function for sampling a batch of data from the replay buffer, with a leading axis of size (sample_batch_size, sample_sequence_length). Note sample_batch_size and sample_sequence_length may be different to the batch size and sequence length of data added to the state using the add function.

can_sample

Whether the buffer can be sampled from, which is determined by if the number of trajectories added to the buffer state is greater than or equal to the min_length.

set_priorities Callable[[BufferState, Indices, Priorities], BufferState]

A pure function for setting the priorities of the data subsequences in the buffer.

See make_prioritised_trajectory_buffer for how this container is instantiated.