Skip to main content

RawModelLayout

Trait RawModelLayout 

Source
pub trait RawModelLayout {
    // Required methods
    fn input(&self) -> usize;
    fn hidden(&self) -> usize;
    fn output(&self) -> usize;
    fn depth(&self) -> usize;

    // Provided methods
    fn dim_input(&self) -> (usize, usize) { ... }
    fn dim_hidden(&self) -> (usize, usize) { ... }
    fn dim_output(&self) -> (usize, usize) { ... }
    fn size(&self) -> usize { ... }
    fn size_input(&self) -> usize { ... }
    fn size_hidden(&self) -> usize { ... }
    fn size_output(&self) -> usize { ... }
}
Expand description

The RawModelLayout trait defines a minimal interface for objects capable of representing the layout; i.e. the number of input, hidden, and output features of a neural network model containing some number of hidden layers.

Note: This trait is implemented for the 3- and 4-tuple consiting of usize elements as well as for the [usize; 3] and [usize; 4] array types. In both these instances, the elements are ordered as (input, hidden, output) for the 3-element versions, and (input, hidden, output, layers) for the 4-element versions.

Required Methods§

Source

fn input(&self) -> usize

returns the total number of input features defined for the model

Source

fn hidden(&self) -> usize

returns the number of hidden features for the model

Source

fn output(&self) -> usize

the number of output features for the model

Source

fn depth(&self) -> usize

returns the number of hidden layers within the network

Provided Methods§

Source

fn dim_input(&self) -> (usize, usize)

the dimension of the input layer; (input, hidden)

Source

fn dim_hidden(&self) -> (usize, usize)

the dimension of the hidden layers; (hidden, hidden)

Source

fn dim_output(&self) -> (usize, usize)

the dimension of the output layer; (hidden, output)

Source

fn size(&self) -> usize

the total number of parameters in the model

Source

fn size_input(&self) -> usize

the total number of input parameters in the model

Source

fn size_hidden(&self) -> usize

the total number of hidden parameters in the model

Source

fn size_output(&self) -> usize

the total number of output parameters in the model

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementations on Foreign Types§

Source§

impl RawModelLayout for (usize, usize, usize)

Source§

fn input(&self) -> usize

Source§

fn hidden(&self) -> usize

Source§

fn depth(&self) -> usize

Source§

fn output(&self) -> usize

Source§

impl RawModelLayout for (usize, usize, usize, usize)

Source§

fn input(&self) -> usize

Source§

fn hidden(&self) -> usize

Source§

fn output(&self) -> usize

Source§

fn depth(&self) -> usize

Source§

impl RawModelLayout for [usize; 3]

Source§

fn input(&self) -> usize

Source§

fn hidden(&self) -> usize

Source§

fn output(&self) -> usize

Source§

fn depth(&self) -> usize

Source§

impl RawModelLayout for [usize; 4]

Source§

fn input(&self) -> usize

Source§

fn hidden(&self) -> usize

Source§

fn output(&self) -> usize

Source§

fn depth(&self) -> usize

Source§

impl<T> RawModelLayout for &T
where T: RawModelLayout,

Source§

fn input(&self) -> usize

Source§

fn hidden(&self) -> usize

Source§

fn depth(&self) -> usize

Source§

fn output(&self) -> usize

Source§

impl<T> RawModelLayout for &mut T
where T: RawModelLayout,

Source§

fn input(&self) -> usize

Source§

fn hidden(&self) -> usize

Source§

fn depth(&self) -> usize

Source§

fn output(&self) -> usize

Implementors§