pub struct MetricsLogger { /* private fields */ }Expand description
Metrics logger that aggregates and logs training metrics.
Collects metrics and logs them using multiple backends.
Implementations§
Source§impl MetricsLogger
impl MetricsLogger
Sourcepub fn add_backend<B: LoggingBackend + Clone + Debug + 'static>(
&mut self,
backend: B,
)
pub fn add_backend<B: LoggingBackend + Clone + Debug + 'static>( &mut self, backend: B, )
Sourcepub fn log_metric(&mut self, name: &str, value: f64) -> TrainResult<()>
pub fn log_metric(&mut self, name: &str, value: f64) -> TrainResult<()>
Sourcepub fn accumulate_metric(&mut self, name: &str, value: f64)
pub fn accumulate_metric(&mut self, name: &str, value: f64)
Accumulate a metric value (for averaging over batch).
§Arguments
name- Metric namevalue- Metric value
Sourcepub fn log_accumulated_metrics(&mut self) -> TrainResult<()>
pub fn log_accumulated_metrics(&mut self) -> TrainResult<()>
Log accumulated metrics (average) and clear accumulation.
Sourcepub fn log_message(&mut self, message: &str) -> TrainResult<()>
pub fn log_message(&mut self, message: &str) -> TrainResult<()>
Sourcepub fn current_step(&self) -> usize
pub fn current_step(&self) -> usize
Get the current step.
Sourcepub fn flush(&mut self) -> TrainResult<()>
pub fn flush(&mut self) -> TrainResult<()>
Flush all backends.
Sourcepub fn num_backends(&self) -> usize
pub fn num_backends(&self) -> usize
Get the number of backends.
Trait Implementations§
Source§impl Debug for MetricsLogger
impl Debug for MetricsLogger
Auto Trait Implementations§
impl Freeze for MetricsLogger
impl !RefUnwindSafe for MetricsLogger
impl !Send for MetricsLogger
impl !Sync for MetricsLogger
impl Unpin for MetricsLogger
impl !UnwindSafe for MetricsLogger
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> 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