pub struct Sac<E, Q, P, R>where
Q: SubModel2<Output = Tensor>,
P: SubModel<Output = (Tensor, Tensor)>,
Q::Config: DeserializeOwned + Serialize + OutDim + Debug + PartialEq + Clone,
P::Config: DeserializeOwned + Serialize + OutDim + Debug + PartialEq + Clone,{ /* private fields */ }Expand description
Soft actor critic (SAC) agent.
Implementations§
Source§impl<E, Q, P, R> Sac<E, Q, P, R>where
E: Env,
Q: SubModel2<Output = Tensor>,
P: SubModel<Output = (Tensor, Tensor)>,
R: ReplayBufferBase,
E::Obs: Into<Q::Input1> + Into<P::Input>,
E::Act: Into<Q::Input2>,
Q::Input2: From<Tensor>,
Q::Config: DeserializeOwned + Serialize + OutDim + Debug + PartialEq + Clone,
P::Config: DeserializeOwned + Serialize + OutDim + Debug + PartialEq + Clone,
R::Batch: TransitionBatch,
<R::Batch as TransitionBatch>::ObsBatch: Into<Q::Input1> + Into<P::Input> + Clone,
<R::Batch as TransitionBatch>::ActBatch: Into<Q::Input2> + Into<Tensor>,
impl<E, Q, P, R> Sac<E, Q, P, R>where
E: Env,
Q: SubModel2<Output = Tensor>,
P: SubModel<Output = (Tensor, Tensor)>,
R: ReplayBufferBase,
E::Obs: Into<Q::Input1> + Into<P::Input>,
E::Act: Into<Q::Input2>,
Q::Input2: From<Tensor>,
Q::Config: DeserializeOwned + Serialize + OutDim + Debug + PartialEq + Clone,
P::Config: DeserializeOwned + Serialize + OutDim + Debug + PartialEq + Clone,
R::Batch: TransitionBatch,
<R::Batch as TransitionBatch>::ObsBatch: Into<Q::Input1> + Into<P::Input> + Clone,
<R::Batch as TransitionBatch>::ActBatch: Into<Q::Input2> + Into<Tensor>,
pub fn get_policy_net(&self) -> &Actor<P>
Trait Implementations§
Source§impl<E, Q, P, R> Agent<E, R> for Sac<E, Q, P, R>where
E: Env,
Q: SubModel2<Output = Tensor>,
P: SubModel<Output = (Tensor, Tensor)>,
R: ReplayBufferBase,
E::Obs: Into<Q::Input1> + Into<P::Input>,
E::Act: Into<Q::Input2> + From<Tensor>,
Q::Input2: From<Tensor>,
Q::Config: DeserializeOwned + Serialize + OutDim + Debug + PartialEq + Clone,
P::Config: DeserializeOwned + Serialize + OutDim + Debug + PartialEq + Clone,
R::Batch: TransitionBatch,
<R::Batch as TransitionBatch>::ObsBatch: Into<Q::Input1> + Into<P::Input> + Clone,
<R::Batch as TransitionBatch>::ActBatch: Into<Q::Input2> + Into<Tensor>,
impl<E, Q, P, R> Agent<E, R> for Sac<E, Q, P, R>where
E: Env,
Q: SubModel2<Output = Tensor>,
P: SubModel<Output = (Tensor, Tensor)>,
R: ReplayBufferBase,
E::Obs: Into<Q::Input1> + Into<P::Input>,
E::Act: Into<Q::Input2> + From<Tensor>,
Q::Input2: From<Tensor>,
Q::Config: DeserializeOwned + Serialize + OutDim + Debug + PartialEq + Clone,
P::Config: DeserializeOwned + Serialize + OutDim + Debug + PartialEq + Clone,
R::Batch: TransitionBatch,
<R::Batch as TransitionBatch>::ObsBatch: Into<Q::Input1> + Into<P::Input> + Clone,
<R::Batch as TransitionBatch>::ActBatch: Into<Q::Input2> + Into<Tensor>,
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 some information.
Source§fn save_params<T: AsRef<Path>>(&self, path: T) -> Result<()>
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§impl<E, Q, P, R> Configurable<E> for Sac<E, Q, P, R>where
E: Env,
Q: SubModel2<Output = Tensor>,
P: SubModel<Output = (Tensor, Tensor)>,
E::Obs: Into<Q::Input1> + Into<P::Input>,
E::Act: Into<Q::Input2> + From<Tensor>,
Q::Config: DeserializeOwned + Serialize + OutDim + Debug + PartialEq + Clone,
P::Config: DeserializeOwned + Serialize + OutDim + Debug + PartialEq + Clone,
impl<E, Q, P, R> Configurable<E> for Sac<E, Q, P, R>where
E: Env,
Q: SubModel2<Output = Tensor>,
P: SubModel<Output = (Tensor, Tensor)>,
E::Obs: Into<Q::Input1> + Into<P::Input>,
E::Act: Into<Q::Input2> + From<Tensor>,
Q::Config: DeserializeOwned + Serialize + OutDim + Debug + PartialEq + Clone,
P::Config: DeserializeOwned + Serialize + OutDim + Debug + PartialEq + Clone,
Source§impl<E, Q, P, R> Policy<E> for Sac<E, Q, P, R>where
E: Env,
Q: SubModel2<Output = Tensor>,
P: SubModel<Output = (Tensor, Tensor)>,
E::Obs: Into<Q::Input1> + Into<P::Input>,
E::Act: Into<Q::Input2> + From<Tensor>,
Q::Config: DeserializeOwned + Serialize + OutDim + Debug + PartialEq + Clone,
P::Config: DeserializeOwned + Serialize + OutDim + Debug + PartialEq + Clone,
impl<E, Q, P, R> Policy<E> for Sac<E, Q, P, R>where
E: Env,
Q: SubModel2<Output = Tensor>,
P: SubModel<Output = (Tensor, Tensor)>,
E::Obs: Into<Q::Input1> + Into<P::Input>,
E::Act: Into<Q::Input2> + From<Tensor>,
Q::Config: DeserializeOwned + Serialize + OutDim + Debug + PartialEq + Clone,
P::Config: DeserializeOwned + Serialize + OutDim + Debug + PartialEq + Clone,
Auto Trait Implementations§
impl<E, Q, P, R> Freeze for Sac<E, Q, P, R>
impl<E, Q, P, R> RefUnwindSafe for Sac<E, Q, P, R>where
<P as SubModel>::Config: Sized,
<Q as SubModel2>::Config: Sized,
P: RefUnwindSafe,
E: RefUnwindSafe,
R: RefUnwindSafe,
Q: RefUnwindSafe,
impl<E, Q, P, R> Send for Sac<E, Q, P, R>
impl<E, Q, P, R> !Sync for Sac<E, Q, P, R>
impl<E, Q, P, R> Unpin for Sac<E, Q, P, R>
impl<E, Q, P, R> UnwindSafe for Sac<E, Q, P, R>where
<P as SubModel>::Config: Sized,
<Q as SubModel2>::Config: Sized,
P: UnwindSafe,
E: UnwindSafe,
R: UnwindSafe,
Q: UnwindSafe,
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