use nove_dataloader::DataloaderError;
use nove_lossfn::LossFnError;
use nove_metric::AnyMetric;
use nove_model::ModelError;
use nove_optimizer::OptimizerError;
use nove_tensor::{DeviceError, TensorError};
use thiserror::Error;
pub mod common;
#[derive(Error, Debug)]
pub enum LearnerError {
#[error(transparent)]
TensorError(#[from] TensorError),
#[error(transparent)]
DeviceError(#[from] DeviceError),
#[error(transparent)]
DataloaderError(#[from] DataloaderError),
#[error(transparent)]
OptimizerError(#[from] OptimizerError),
#[error(transparent)]
ModelError(#[from] ModelError),
#[error(transparent)]
LossfnError(#[from] LossFnError),
#[error(transparent)]
MetricError(#[from] nove_metric::MetricError),
#[error("Missing argument: {0}")]
MissingArgument(String),
#[error("Invalid argument: {0}")]
InvalidArgument(String),
#[error("Invalid path: {0}")]
InvalidPath(String),
#[error("Other errors: {0}")]
OtherError(String),
}
pub trait Learner {
fn train(&mut self) -> Result<(), LearnerError>;
fn validate(&mut self) -> Result<Vec<AnyMetric>, LearnerError>;
fn test(&mut self) -> Result<Vec<AnyMetric>, LearnerError>;
}