use crate::kan::kan_error::KanError;
#[derive(Clone, PartialEq, Debug)]
pub struct TrainingError {
pub source: KanError,
pub epoch: usize,
pub sample: usize,
}
impl std::fmt::Display for TrainingError {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
write!(
f,
"epoch {} sample {} encountered error {}",
self.epoch, self.sample, self.source
)
}
}
impl std::error::Error for TrainingError {
fn source(&self) -> Option<&(dyn std::error::Error + 'static)> {
Some(&self.source)
}
}