Forward

Trait Forward 

Source
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§

Source

fn forward(&self, input: &Rhs) -> Self::Output

a single forward step

Provided Methods§

Source

fn forward_then<F>(&self, input: &Rhs, then: F) -> Self::Output
where F: FnOnce(Self::Output) -> 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.

Implementations on Foreign Types§

Source§

impl<X, Y, A, S, D> Forward<X> for ArrayBase<S, D, A>
where A: Clone, D: Dimension, S: Data<Elem = A>, for<'a> X: Dot<ArrayBase<S, D, A>, Output = Y>,

Source§

type Output = Y

Source§

fn forward(&self, input: &X) -> Self::Output

Implementors§

Source§

impl<F, X, Y> Forward<X> for F
where F: Fn(&X) -> Y,