Struct border_tch_agent::sac::Sac
source · pub struct 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: StdBatchBase,
<R::Batch as StdBatchBase>::ObsBatch: Into<Q::Input1> + Into<P::Input> + Clone,
<R::Batch as StdBatchBase>::ActBatch: Into<Q::Input2> + Into<Tensor>,{ /* private fields */ }Expand description
Soft actor critic (SAC) agent.
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: StdBatchBase,
<R::Batch as StdBatchBase>::ObsBatch: Into<Q::Input1> + Into<P::Input> + Clone,
<R::Batch as StdBatchBase>::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: StdBatchBase, <R::Batch as StdBatchBase>::ObsBatch: Into<Q::Input1> + Into<P::Input> + Clone, <R::Batch as StdBatchBase>::ActBatch: Into<Q::Input2> + Into<Tensor>,
source§fn save<T: AsRef<Path>>(&self, path: T) -> Result<()>
fn save<T: AsRef<Path>>(&self, path: T) -> Result<()>
Save 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> Policy<E> 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: StdBatchBase,
<R::Batch as StdBatchBase>::ObsBatch: Into<Q::Input1> + Into<P::Input> + Clone,
<R::Batch as StdBatchBase>::ActBatch: Into<Q::Input2> + Into<Tensor>,
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)>, 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: StdBatchBase, <R::Batch as StdBatchBase>::ObsBatch: Into<Q::Input1> + Into<P::Input> + Clone, <R::Batch as StdBatchBase>::ActBatch: Into<Q::Input2> + Into<Tensor>,
Auto Trait Implementations§
impl<E, Q, P, R> RefUnwindSafe for Sac<E, Q, P, R>where E: RefUnwindSafe, P: RefUnwindSafe, Q: RefUnwindSafe, R: RefUnwindSafe,
impl<E, Q, P, R> Send for Sac<E, Q, P, R>where E: Send, P: Send, Q: Send, R: Send,
impl<E, Q, P, R> !Sync for Sac<E, Q, P, R>
impl<E, Q, P, R> Unpin for Sac<E, Q, P, R>where E: Unpin, P: Unpin, Q: Unpin, R: Unpin,
impl<E, Q, P, R> UnwindSafe for Sac<E, Q, P, R>where E: UnwindSafe, P: UnwindSafe, Q: UnwindSafe, R: 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