pub struct CandleStochasticPolicy { /* private fields */ }Implementations§
Source§impl CandleStochasticPolicy
impl CandleStochasticPolicy
Sourcepub fn sac_actor_step(
&mut self,
obs: &TensorData,
alpha: f32,
critic: &CandleTwinQ,
) -> Result<TrainMetrics, NNError>
pub fn sac_actor_step( &mut self, obs: &TensorData, alpha: f32, critic: &CandleTwinQ, ) -> Result<TrainMetrics, NNError>
SAC actor gradient step with autograd flowing through the critic.
Takes concrete CandleTwinQ to preserve gradient flow from Q-values
back to actor parameters via the reparameterized actions.
Trait Implementations§
Source§impl StochasticPolicy for CandleStochasticPolicy
impl StochasticPolicy for CandleStochasticPolicy
Source§fn sample_actions(
&self,
obs: &TensorData,
) -> Result<(TensorData, TensorData), NNError>
fn sample_actions( &self, obs: &TensorData, ) -> Result<(TensorData, TensorData), NNError>
Sample actions with reparameterization trick.
Returns (squashed_actions [batch, act_dim], log_probs [batch]).
Source§fn deterministic_action(&self, obs: &TensorData) -> Result<TensorData, NNError>
fn deterministic_action(&self, obs: &TensorData) -> Result<TensorData, NNError>
Deterministic action (mean through squashing).
fn learning_rate(&self) -> f32
fn set_learning_rate(&mut self, lr: f32)
fn save(&self, path: &Path) -> Result<(), NNError>
fn load(&mut self, path: &Path) -> Result<(), NNError>
impl Send for CandleStochasticPolicy
impl Sync for CandleStochasticPolicy
Auto Trait Implementations§
impl Freeze for CandleStochasticPolicy
impl !RefUnwindSafe for CandleStochasticPolicy
impl Unpin for CandleStochasticPolicy
impl UnsafeUnpin for CandleStochasticPolicy
impl !UnwindSafe for CandleStochasticPolicy
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
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more