pub trait Forward<Rhs> {
type Output;
// Required method
fn forward(&self, input: &Rhs) -> Self::Output;
// Provided method
fn forward_then<F>(&self, input: &Rhs, then: F) -> Self::Output
where F: FnOnce(Self::Output) -> Self::Output { ... }
}Expand description
The Forward trait describes a common interface for objects designated to perform a
single forward step in a neural network or machine learning model.
Required Associated Types§
Required Methods§
Provided Methods§
Sourcefn forward_then<F>(&self, input: &Rhs, then: F) -> Self::Output
fn forward_then<F>(&self, input: &Rhs, then: F) -> Self::Output
this method enables the forward pass to be generically activated using some closure. This is useful for isolating the logic of the forward pass from that of the activation function and is often used by layers and models.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.