pub struct Dqn<E, Q, R>where
Q: SubModel<Output = Tensor>,
Q::Config: DeserializeOwned + Serialize + OutDim + Debug + PartialEq + Clone,{ /* private fields */ }Expand description
DQN agent implemented with tch-rs.
Trait Implementations§
Source§impl<E, Q, R> Agent<E, R> for Dqn<E, Q, R>where
E: Env + 'static,
Q: SubModel<Output = Tensor> + 'static,
R: ReplayBufferBase + 'static,
E::Obs: Into<Q::Input>,
E::Act: From<Q::Output>,
Q::Config: DeserializeOwned + Serialize + OutDim + Debug + PartialEq + Clone,
R::Batch: TransitionBatch,
<R::Batch as TransitionBatch>::ObsBatch: Into<Q::Input>,
<R::Batch as TransitionBatch>::ActBatch: Into<Tensor>,
impl<E, Q, R> Agent<E, R> for Dqn<E, Q, R>where
E: Env + 'static,
Q: SubModel<Output = Tensor> + 'static,
R: ReplayBufferBase + 'static,
E::Obs: Into<Q::Input>,
E::Act: From<Q::Output>,
Q::Config: DeserializeOwned + Serialize + OutDim + Debug + PartialEq + Clone,
R::Batch: TransitionBatch,
<R::Batch as TransitionBatch>::ObsBatch: Into<Q::Input>,
<R::Batch as TransitionBatch>::ActBatch: Into<Tensor>,
Source§fn save_params(&self, path: &Path) -> Result<Vec<PathBuf>>
fn save_params(&self, path: &Path) -> Result<Vec<PathBuf>>
Save model parameters in the given directory.
The parameters of the model are saved as qnet.pt.
The parameters of the target model are saved as qnet_tgt.pt.
Source§fn opt(&mut self, buffer: &mut R)
fn opt(&mut self, buffer: &mut R)
Performs a single optimization step using experiences from the replay buffer. Read more
Source§fn opt_with_record(&mut self, buffer: &mut R) -> Record
fn opt_with_record(&mut self, buffer: &mut R) -> Record
Performs an optimization step and returns training metrics. Read more
Source§fn load_params(&mut self, path: &Path) -> Result<()>
fn load_params(&mut self, path: &Path) -> Result<()>
Loads the agent’s parameters from the specified directory. Read more
Source§fn as_any_mut(&mut self) -> &mut dyn Any
fn as_any_mut(&mut self) -> &mut dyn Any
Returns a mutable reference to the agent as a type-erased
Any value. Read moreSource§fn as_any_ref(&self) -> &dyn Any
fn as_any_ref(&self) -> &dyn Any
Returns a reference to the agent as a type-erased
Any value. Read moreSource§impl<E, Q, R> Configurable for Dqn<E, Q, R>
impl<E, Q, R> Configurable for Dqn<E, Q, R>
Auto Trait Implementations§
impl<E, Q, R> Freeze for Dqn<E, Q, R>
impl<E, Q, R> RefUnwindSafe for Dqn<E, Q, R>
impl<E, Q, R> Send for Dqn<E, Q, R>
impl<E, Q, R> !Sync for Dqn<E, Q, R>
impl<E, Q, R> Unpin for Dqn<E, Q, R>
impl<E, Q, R> UnwindSafe for Dqn<E, Q, R>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more