Struct SimpleReplayBuffer

Source
pub struct SimpleReplayBuffer<O, A>
where O: BatchBase, A: BatchBase,
{ /* private fields */ }
Expand description

A simple generic replay buffer.

Trait Implementations§

Source§

impl Agent<TestEnv, SimpleReplayBuffer<TestObsBatch, TestActBatch>> for TestAgent

Source§

fn train(&mut self)

Set the policy to training mode.
Source§

fn is_train(&self) -> bool

Return if it is in training mode.
Source§

fn eval(&mut self)

Set the policy to evaluation mode.
Source§

fn opt_with_record( &mut self, _buffer: &mut SimpleReplayBuffer<TestObsBatch, TestActBatch>, ) -> Record

Performs an optimization step and returns some information.
Source§

fn save_params<T: AsRef<Path>>(&self, _path: T) -> Result<()>

Save the parameters of the agent in the given directory. This method commonly creates a number of files consisting the agent in the directory. For example, the DQN agent in border_tch_agent crate saves two Q-networks corresponding to the original and target networks.
Source§

fn load_params<T: AsRef<Path>>(&mut self, _path: T) -> Result<()>

Load the parameters of the agent from the given directory.
Source§

fn opt(&mut self, buffer: &mut R)

Performs an optimization step. Read more
Source§

impl<O, A> ExperienceBufferBase for SimpleReplayBuffer<O, A>
where O: BatchBase, A: BatchBase,

Source§

type Item = GenericTransitionBatch<O, A>

Items pushed into the buffer.
Source§

fn len(&self) -> usize

The number of samples in the buffer.
Source§

fn push(&mut self, tr: Self::Item) -> Result<()>

Pushes a transition into the buffer.
Source§

impl<O, A> ReplayBufferBase for SimpleReplayBuffer<O, A>
where O: BatchBase, A: BatchBase,

Source§

type Config = SimpleReplayBufferConfig

Configuration of the replay buffer.
Source§

type Batch = GenericTransitionBatch<O, A>

Batch generated from the buffer.
Source§

fn build(config: &Self::Config) -> Self

Build a replay buffer from Self::Config.
Source§

fn batch(&mut self, size: usize) -> Result<Self::Batch>

Constructs a batch. Read more
Source§

fn update_priority( &mut self, ixs: &Option<Vec<usize>>, td_errs: &Option<Vec<f32>>, )

Updates priority. Read more

Auto Trait Implementations§

§

impl<O, A> Freeze for SimpleReplayBuffer<O, A>
where O: Freeze, A: Freeze,

§

impl<O, A> RefUnwindSafe for SimpleReplayBuffer<O, A>

§

impl<O, A> Send for SimpleReplayBuffer<O, A>
where O: Send, A: Send,

§

impl<O, A> Sync for SimpleReplayBuffer<O, A>
where O: Sync, A: Sync,

§

impl<O, A> Unpin for SimpleReplayBuffer<O, A>
where O: Unpin, A: Unpin,

§

impl<O, A> UnwindSafe for SimpleReplayBuffer<O, A>
where O: UnwindSafe, A: UnwindSafe,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V