pub trait Forward<Rhs> {
type Output;
// Required method
fn forward(&self, input: &Rhs) -> Result<Self::Output>;
// Provided method
fn forward_then<F>(&self, input: &Rhs, then: F) -> Result<Self::Output>
where F: FnOnce(Self::Output) -> Self::Output { ... }
}
Expand description
This trait denotes entities capable of performing a single forward step
Required Associated Types§
Required Methods§
Provided Methods§
Sourcefn forward_then<F>(&self, input: &Rhs, then: F) -> Result<Self::Output>
fn forward_then<F>(&self, input: &Rhs, then: F) -> Result<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.