pub struct MANN<F: Float + Debug + ScalarOperand> { /* private fields */ }Expand description
Memory-Augmented Neural Network (MANN)
Implementations§
Source§impl<F: Float + Debug + Clone + FromPrimitive + ScalarOperand> MANN<F>
impl<F: Float + Debug + Clone + FromPrimitive + ScalarOperand> MANN<F>
Sourcepub fn new(
memory_size: usize,
memory_width: usize,
controller_input_dim: usize,
controller_hidden_dim: usize,
controller_output_dim: usize,
) -> Self
pub fn new( memory_size: usize, memory_width: usize, controller_input_dim: usize, controller_hidden_dim: usize, controller_output_dim: usize, ) -> Self
Create new Memory-Augmented Neural Network
Sourcepub fn reset_memory(&mut self)
pub fn reset_memory(&mut self)
Reset memory
Sourcepub fn train_few_shot(&mut self, episodes: &[FewShotEpisode<F>]) -> Result<F>
pub fn train_few_shot(&mut self, episodes: &[FewShotEpisode<F>]) -> Result<F>
Train MANN on few-shot learning task
Sourcepub fn get_memory(&self) -> &Array2<F>
pub fn get_memory(&self) -> &Array2<F>
Get current memory state
Sourcepub fn set_memory(&mut self, memory: Array2<F>) -> Result<()>
pub fn set_memory(&mut self, memory: Array2<F>) -> Result<()>
Set memory state
Sourcepub fn get_controller_params(&self) -> &Array2<F>
pub fn get_controller_params(&self) -> &Array2<F>
Get controller parameters
Sourcepub fn set_controller_params(&mut self, params: Array2<F>) -> Result<()>
pub fn set_controller_params(&mut self, params: Array2<F>) -> Result<()>
Set controller parameters
Sourcepub fn memory_dimensions(&self) -> (usize, usize)
pub fn memory_dimensions(&self) -> (usize, usize)
Get memory dimensions
Sourcepub fn controller_dimensions(&self) -> (usize, usize, usize)
pub fn controller_dimensions(&self) -> (usize, usize, usize)
Get controller dimensions
Sourcepub fn process_sequence(
&mut self,
inputs: &[Array1<F>],
) -> Result<Vec<Array1<F>>>
pub fn process_sequence( &mut self, inputs: &[Array1<F>], ) -> Result<Vec<Array1<F>>>
Process a sequence of inputs
Sourcepub fn compute_attention_weights(&self, key: &Array1<F>) -> Result<Array1<F>>
pub fn compute_attention_weights(&self, key: &Array1<F>) -> Result<Array1<F>>
Compute attention weights for memory addressing (simplified)
Trait Implementations§
Auto Trait Implementations§
impl<F> Freeze for MANN<F>
impl<F> RefUnwindSafe for MANN<F>where
F: RefUnwindSafe,
impl<F> Send for MANN<F>where
F: Send,
impl<F> Sync for MANN<F>where
F: Sync,
impl<F> Unpin for MANN<F>
impl<F> UnwindSafe for MANN<F>where
F: RefUnwindSafe,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> Pointable for T
impl<T> Pointable for T
Source§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
Source§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
The inverse inclusion map: attempts to construct
self from the equivalent element of its
superset. Read moreSource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
Checks if
self is actually part of its subset T (and can be converted to it).Source§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
Use with care! Same as
self.to_subset but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
The inclusion map: converts
self to the equivalent element of its superset.