pub type BackwardOutput = (Vec<f64>, Vec<(Vec<f64>, Vec<f64>)>);
pub trait Layer: Send {
fn forward(&mut self, input: &[f64], batch: usize, training: bool) -> Vec<f64>;
fn backward(&self, grad_output: &[f64]) -> BackwardOutput;
fn n_param_groups(&self) -> usize;
fn params_mut(&mut self) -> Vec<(&mut Vec<f64>, &mut Vec<f64>)>;
fn save_params(&self) -> Vec<(Vec<f64>, Vec<f64>)>;
fn restore_params(&mut self, saved: &[(Vec<f64>, Vec<f64>)]);
fn in_size(&self) -> usize;
fn out_size(&self) -> usize;
fn name(&self) -> &'static str;
}