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 + 'static,
Q: SubModel2<Output = Tensor> + 'static,
P: SubModel<Output = (Tensor, Tensor)> + 'static,
R: ReplayBufferBase + 'static,
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 + 'static,
Q: SubModel2<Output = Tensor> + 'static,
P: SubModel<Output = (Tensor, Tensor)> + 'static,
R: ReplayBufferBase + 'static,
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 training metrics. Read more
Source§fn save_params(&self, path: &Path) -> Result<Vec<PathBuf>>
fn save_params(&self, path: &Path) -> Result<Vec<PathBuf>>
Saves the agent’s parameters to the specified directory. 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, P, R> Configurable 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 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