pub trait Layer:
Any
+ Send
+ Sync {
// Required methods
fn forward(
&self,
inputs: &dyn ArrayProtocol,
) -> Result<Box<dyn ArrayProtocol>, OperationError>;
fn parameters(&self) -> Vec<Box<dyn ArrayProtocol>>;
fn train(&mut self);
fn eval(&mut self);
fn is_training(&self) -> bool;
fn name(&self) -> &str;
fn as_any(&self) -> &dyn Any;
}
Expand description
Trait for neural network layers.
Required Methods§
Sourcefn forward(
&self,
inputs: &dyn ArrayProtocol,
) -> Result<Box<dyn ArrayProtocol>, OperationError>
fn forward( &self, inputs: &dyn ArrayProtocol, ) -> Result<Box<dyn ArrayProtocol>, OperationError>
Forward pass through the layer.
Sourcefn parameters(&self) -> Vec<Box<dyn ArrayProtocol>>
fn parameters(&self) -> Vec<Box<dyn ArrayProtocol>>
Get the layer’s parameters.
Sourcefn is_training(&self) -> bool
fn is_training(&self) -> bool
Check if the layer is in training mode.