MLP

Struct MLP 

Source
pub struct MLP { /* private fields */ }
Expand description

A multilayer perceptron.

A multilayer perceptron is a collection of Layers. It calculates the output of each layer and passes it to the next layer. The output of the MLP is the output of the last layer.

Implementations§

Source§

impl MLP

Source

pub fn new( n_inputs: u32, input_activation: Activation, n_hidden: Vec<u32>, hidden_activation: Activation, n_outputs: u32, output_activation: Activation, ) -> MLP

Create a new multilayer perceptron (MLP) with the given number of inputs, hidden layers, and outputs.

The MLP is a collection of Layers. The total number of layers is n_hidden.len() + 2. The first layer has n_inputs inputs and n_hidden[0] neurons. The hidden layer i has n_hidden[i] neurons. There are n_hidden.len() hidden layers. The last layer has n_hidden[n_hidden.len() - 1] inputs and n_outputs neurons. The activation functions for the input, hidden, and output layers are input_activation, hidden_activation, and output_activation, respectively.

Source

pub fn forward(&self, x: Vec<Expr>) -> Vec<Expr>

Calculate the output of the MLP for the given inputs.

The output of the MLP is the output of the last layer.

Trait Implementations§

Source§

impl Display for MLP

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl Freeze for MLP

§

impl RefUnwindSafe for MLP

§

impl Send for MLP

§

impl Sync for MLP

§

impl Unpin for MLP

§

impl UnwindSafe for MLP

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V