Forward

Trait Forward 

Source
pub trait Forward {
    // Required method
    fn forward(&self, input: &Tensor) -> Tensor;
}
Expand description

A feed-forward function of a tensor.

This is roughtly equivalent to PyTorch’s module class except it is not treated as the base interface of all modules because not all modules implement the batch Tensor -> Tensor transformation.

Required Methods§

Source

fn forward(&self, input: &Tensor) -> Tensor

Apply a batch feed-forward transformation to a tensor.

Applies a vector-to-vector map on the last dimension of the input tensor, replicated over all other dimensions.

  • Input shape: [BATCH_SHAPE.., INPUT_DIM].
  • Output shape: [BATCH_SHAPE.., OUTPUT_DIM].

Implementations on Foreign Types§

Source§

impl<M: Forward> Forward for [M]

Source§

fn forward(&self, input: &Tensor) -> Tensor

Source§

impl<M: Forward, const N: usize> Forward for [M; N]

Source§

fn forward(&self, input: &Tensor) -> Tensor

Source§

impl<T: Forward + ?Sized> Forward for &T

Source§

fn forward(&self, input: &Tensor) -> Tensor

Source§

impl<T: Forward + ?Sized> Forward for Box<T>

Source§

fn forward(&self, input: &Tensor) -> Tensor

Implementors§

Source§

impl Forward for Activation

Source§

impl Forward for Linear

Source§

impl Forward for Mlp

Source§

impl<A, B> Forward for Chain<A, B>
where A: Forward, B: Forward,

Source§

impl<T, F> Forward for BatchMap<T, F>
where T: Forward, F: Fn(Tensor) -> Tensor,