use concision_params::RawParams;
use concision_traits::{RawStore, RawStoreMut, Store};
use ndarray::{Dimension, RawData};
pub trait NetworkParams<S, D, A = <S as RawData>::Elem>
where
D: Dimension,
S: RawData<Elem = A>,
{
}
pub trait NetworkConfig<K, V> {
type Store: RawStore<K, V>;
fn store(&self) -> &Self::Store;
fn store_mut(&mut self) -> &mut Self::Store;
fn get<'a>(&'a self, key: &K) -> Option<&'a V>
where
Self::Store: 'a,
{
self.store().get(key)
}
fn get_mut<'a>(&'a mut self, key: &K) -> Option<&'a mut V>
where
Self::Store: 'a + RawStoreMut<K, V>,
{
self.store_mut().get_mut(key)
}
fn hyperparam<'a>(&'a mut self, key: K) -> <Self::Store as Store<K, V>>::Entry<'a>
where
Self::Store: 'a + Store<K, V>,
{
self.store_mut().entry(key)
}
}
pub trait NeuralNetwork<A>
where
Self::Params<A>: RawParams<Elem = A>,
{
type Config: NetworkConfig<String, A>;
type Params<_A>;
fn config(&self) -> &Self::Config;
fn params(&self) -> &Self::Params<A>;
fn params_mut(&mut self) -> &mut Self::Params<A>;
}
pub trait NetworkConsts {
const NAME: &'static str;
const VERSION: &'static str;
}