pub struct ProgressiveNetworks<T: Float + Debug + Send + Sync + 'static> { /* private fields */ }Expand description
Progressive Networks for continual learning.
Each new task gets its own column (set of layers). Previous columns are frozen and lateral connections from frozen columns feed into the new column, enabling knowledge transfer without forgetting.
Implementations§
Source§impl<T: Float + Debug + Send + Sync + 'static> ProgressiveNetworks<T>
impl<T: Float + Debug + Send + Sync + 'static> ProgressiveNetworks<T>
Sourcepub fn new(hidden_sizes: Vec<usize>) -> Self
pub fn new(hidden_sizes: Vec<usize>) -> Self
Create a new progressive network with the given hidden layer sizes.
No columns are created initially; call add_task_column for each task.
Sourcepub fn add_task_column(
&mut self,
input_size: usize,
output_size: usize,
) -> Result<usize>
pub fn add_task_column( &mut self, input_size: usize, output_size: usize, ) -> Result<usize>
Add a new column for a new task.
input_size - dimensionality of the input features.
output_size - dimensionality of the output.
Returns the column index (task id). All previously existing columns are frozen.
Sourcepub fn forward(&self, input: &Array1<T>, task_id: usize) -> Result<Array1<T>>
pub fn forward(&self, input: &Array1<T>, task_id: usize) -> Result<Array1<T>>
Forward pass through the network for a specific task.
For columns beyond the first, lateral connections from all previous columns are added at each hidden layer.
Sourcepub fn forward_with_laterals(
&self,
input: &Array1<T>,
task_id: usize,
) -> Result<(Array1<T>, Vec<Array1<T>>)>
pub fn forward_with_laterals( &self, input: &Array1<T>, task_id: usize, ) -> Result<(Array1<T>, Vec<Array1<T>>)>
Forward pass that also returns intermediate activations from all columns.
Returns (final_output, all_intermediate_activations) where
all_intermediate_activations[col][layer] is the activation at that layer
of that column.
Sourcepub fn freeze_column(&mut self, column_id: usize) -> Result<()>
pub fn freeze_column(&mut self, column_id: usize) -> Result<()>
Freeze a specific column (mark as non-trainable).
Sourcepub fn num_columns(&self) -> usize
pub fn num_columns(&self) -> usize
Return the number of columns (one per task).
Sourcepub fn get_column_parameters(
&self,
column_id: usize,
) -> Result<&NetworkColumn<T>>
pub fn get_column_parameters( &self, column_id: usize, ) -> Result<&NetworkColumn<T>>
Get a reference to a specific column’s parameters.
Auto Trait Implementations§
impl<T> Freeze for ProgressiveNetworks<T>
impl<T> RefUnwindSafe for ProgressiveNetworks<T>where
T: RefUnwindSafe,
impl<T> Send for ProgressiveNetworks<T>
impl<T> Sync for ProgressiveNetworks<T>
impl<T> Unpin for ProgressiveNetworks<T>
impl<T> UnsafeUnpin for ProgressiveNetworks<T>
impl<T> UnwindSafe for ProgressiveNetworks<T>where
T: 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
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>
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>
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>
self from the equivalent element of its
superset. Read moreSource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
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
self.to_subset but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
self to the equivalent element of its superset.