pub struct OptimizerMonitor { /* private fields */ }Expand description
Main optimizer monitor that tracks various metrics.
Implementations§
Source§impl OptimizerMonitor
impl OptimizerMonitor
Sourcepub fn new(config: MonitoringConfig) -> Self
pub fn new(config: MonitoringConfig) -> Self
Create a new optimizer monitor.
Sourcepub fn with_defaults() -> Self
pub fn with_defaults() -> Self
Create a monitor with default configuration.
Sourcepub fn before_step(&mut self)
pub fn before_step(&mut self)
Called before an optimizer step to start timing.
Sourcepub fn after_step(
&mut self,
learning_rate: f32,
parameters: &[Tensor],
loss: Option<f32>,
) -> Result<()>
pub fn after_step( &mut self, learning_rate: f32, parameters: &[Tensor], loss: Option<f32>, ) -> Result<()>
Called after an optimizer step to record metrics.
Sourcepub fn update_loss(&mut self, loss: f32)
pub fn update_loss(&mut self, loss: f32)
Update loss value (can be called independently of step).
Sourcepub fn get_metrics(&self) -> &OptimizerMetrics
pub fn get_metrics(&self) -> &OptimizerMetrics
Get current metrics.
Sourcepub fn should_log(&self) -> bool
pub fn should_log(&self) -> bool
Check if we should log detailed metrics this step.
Sourcepub fn get_summary_report(&self) -> String
pub fn get_summary_report(&self) -> String
Get a summary report of current optimizer status.
Sourcepub fn get_convergence_report(&self) -> String
pub fn get_convergence_report(&self) -> String
Get convergence status report.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for OptimizerMonitor
impl RefUnwindSafe for OptimizerMonitor
impl Send for OptimizerMonitor
impl Sync for OptimizerMonitor
impl Unpin for OptimizerMonitor
impl UnwindSafe for OptimizerMonitor
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
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§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