pub struct KFACApproximation { /* private fields */ }Expand description
K-FAC approximation for full network
Implementations§
Source§impl KFACApproximation
impl KFACApproximation
Sourcepub fn new(layer_dims: &[(usize, usize)]) -> Self
pub fn new(layer_dims: &[(usize, usize)]) -> Self
Create K-FAC optimizer for a network
§Arguments
layer_dims- List of (input_dim, output_dim) for each layer
Sourcepub fn with_learning_rate(self, lr: f64) -> Self
pub fn with_learning_rate(self, lr: f64) -> Self
Set learning rate
Sourcepub fn with_damping(self, damping: f64) -> Self
pub fn with_damping(self, damping: f64) -> Self
Set damping
Sourcepub fn update_layer(
&mut self,
layer_idx: usize,
activations: &[Vec<f64>],
gradients: &[Vec<f64>],
) -> Result<()>
pub fn update_layer( &mut self, layer_idx: usize, activations: &[Vec<f64>], gradients: &[Vec<f64>], ) -> Result<()>
Update factors for a layer
Sourcepub fn natural_gradient_layer(
&self,
layer_idx: usize,
weight_grad: &[Vec<f64>],
) -> Result<Vec<Vec<f64>>>
pub fn natural_gradient_layer( &self, layer_idx: usize, weight_grad: &[Vec<f64>], ) -> Result<Vec<Vec<f64>>>
Compute natural gradient for a layer’s weights
Sourcepub fn num_layers(&self) -> usize
pub fn num_layers(&self) -> usize
Get number of layers
Trait Implementations§
Source§impl Clone for KFACApproximation
impl Clone for KFACApproximation
Source§fn clone(&self) -> KFACApproximation
fn clone(&self) -> KFACApproximation
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for KFACApproximation
impl RefUnwindSafe for KFACApproximation
impl Send for KFACApproximation
impl Sync for KFACApproximation
impl Unpin for KFACApproximation
impl UnwindSafe for KFACApproximation
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