pub struct CallbackContext {
pub epoch: usize,
pub max_epochs: usize,
pub step: usize,
pub steps_per_epoch: usize,
pub global_step: usize,
pub loss: f32,
pub lr: f32,
pub best_loss: Option<f32>,
pub val_loss: Option<f32>,
pub elapsed_secs: f64,
}Expand description
Context passed to callbacks with current training state
Fields§
§epoch: usizeCurrent epoch (0-indexed)
max_epochs: usizeTotal epochs planned
step: usizeCurrent step within epoch
steps_per_epoch: usizeTotal steps in epoch
global_step: usizeGlobal step count
loss: f32Current loss value
lr: f32Current learning rate
best_loss: Option<f32>Best loss seen so far
val_loss: Option<f32>Validation loss (if available)
elapsed_secs: f64Training duration in seconds
Trait Implementations§
Source§impl Clone for CallbackContext
impl Clone for CallbackContext
Source§fn clone(&self) -> CallbackContext
fn clone(&self) -> CallbackContext
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for CallbackContext
impl Debug for CallbackContext
Auto Trait Implementations§
impl Freeze for CallbackContext
impl RefUnwindSafe for CallbackContext
impl Send for CallbackContext
impl Sync for CallbackContext
impl Unpin for CallbackContext
impl UnwindSafe for CallbackContext
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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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