Trait Forward

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

Source

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

a single forward step

Provided Methods§

Source

fn forward_then<F>(&self, input: &Rhs, then: F) -> Result<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>
where A: Clone, D: Dimension, S: Data<Elem = A>, for<'a> X: Dot<ArrayBase<S, D>, Output = Y>,

Source§

type Output = Y

Source§

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

Implementors§

Source§

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