SubModel

Trait SubModel 

Source
pub trait SubModel {
    type Config;
    type Input;
    type Output;

    // Required methods
    fn build(var_store: &VarStore, config: Self::Config) -> Self;
    fn clone_with_var_store(&self, var_store: &VarStore) -> Self;
    fn forward(&self, input: &Self::Input) -> Self::Output;
}
Expand description

Neural network model that can be initialized with VarStore and configuration.

The purpose of this trait is for modularity of neural network models. Modules, which consists a neural network, should share VarStore. To do this, structs implementing this trait can be initialized with a given VarStore. This trait also provide the ability to clone with a given VarStore. The ability is useful when creating a target network, used in recent deep learning algorithms in common.

Required Associated Types§

Source

type Config

Configuration from which SubModel is constructed.

Source

type Input

Input of the SubModel.

Source

type Output

Output of the SubModel.

Required Methods§

Source

fn build(var_store: &VarStore, config: Self::Config) -> Self

Source

fn clone_with_var_store(&self, var_store: &VarStore) -> Self

Clones SubModel with VarStore.

Source

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

A generalized forward function.

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.

Implementors§