pub trait ReplayBufferBase {
type Config: Clone;
type Batch;
// Required methods
fn build(config: &Self::Config) -> Self;
fn batch(&mut self, size: usize) -> Result<Self::Batch>;
fn update_priority(
&mut self,
ixs: &Option<Vec<usize>>,
td_err: &Option<Vec<f32>>,
);
}
Expand description
Interface for replay buffers that generate batches for training.
This trait provides functionality for sampling batches of experiences
for training agents. It is independent of ExperienceBufferBase
and
focuses solely on the batch generation process.
§Associated Types
Config
- Configuration parameters for the bufferBatch
- The type of batch generated for training
Required Associated Types§
Required Methods§
Sourcefn update_priority(
&mut self,
ixs: &Option<Vec<usize>>,
td_err: &Option<Vec<f32>>,
)
fn update_priority( &mut self, ixs: &Option<Vec<usize>>, td_err: &Option<Vec<f32>>, )
Updates the priorities of experiences in the buffer.
This method is used in prioritized experience replay to adjust the sampling probabilities of experiences based on their TD errors.
§Arguments
ixs
- Optional indices of experiences to updatetd_err
- Optional TD errors for the experiences
§Note
This method is optional and may be moved to a separate trait in future versions to better support non-prioritized replay buffers.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.