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§
Required Methods§
Sourcefn build(var_store: &VarStore, config: Self::Config) -> Self
fn build(var_store: &VarStore, config: Self::Config) -> Self
Builds SubModel with VarStore and SubModel::Config.
Sourcefn clone_with_var_store(&self, var_store: &VarStore) -> Self
fn clone_with_var_store(&self, var_store: &VarStore) -> Self
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.