pub trait KerasLayer: Send + Sync {
// Required methods
fn build(&mut self, input_shape: &[usize]) -> Result<()>;
fn call(&self, inputs: &ArrayD<f64>) -> Result<ArrayD<f64>>;
fn compute_output_shape(&self, input_shape: &[usize]) -> Vec<usize>;
fn name(&self) -> &str;
fn get_weights(&self) -> Vec<ArrayD<f64>> ⓘ;
fn set_weights(&mut self, weights: Vec<ArrayD<f64>>) -> Result<()>;
fn built(&self) -> bool;
// Provided method
fn count_params(&self) -> usize { ... }
}
Expand description
Keras-style layer trait
Required Methods§
Sourcefn build(&mut self, input_shape: &[usize]) -> Result<()>
fn build(&mut self, input_shape: &[usize]) -> Result<()>
Build the layer (called during model compilation)
Sourcefn compute_output_shape(&self, input_shape: &[usize]) -> Vec<usize>
fn compute_output_shape(&self, input_shape: &[usize]) -> Vec<usize>
Compute output shape given input shape
Provided Methods§
Sourcefn count_params(&self) -> usize
fn count_params(&self) -> usize
Get number of parameters