pub struct KFACUtils;Expand description
K-FAC utilities for layer-specific operations
Implementations§
Source§impl KFACUtils
impl KFACUtils
Sourcepub fn conv_kfac_update<T: Float + 'static>(
input_patches: &Array2<T>,
output_gradients: &Array2<T>,
kernel_size: (usize, usize),
stride: (usize, usize),
padding: (usize, usize),
) -> Result<Array2<T>>
pub fn conv_kfac_update<T: Float + 'static>( input_patches: &Array2<T>, output_gradients: &Array2<T>, kernel_size: (usize, usize), stride: (usize, usize), padding: (usize, usize), ) -> Result<Array2<T>>
Compute K-FAC update for convolutional layers
Sourcepub fn batchnorm_statistics<T: Float + FromPrimitive>(
input: &Array2<T>,
eps: T,
) -> Result<(Array1<T>, Array1<T>)>
pub fn batchnorm_statistics<T: Float + FromPrimitive>( input: &Array2<T>, eps: T, ) -> Result<(Array1<T>, Array1<T>)>
Compute batch normalization statistics for K-FAC
Sourcepub fn grouped_conv_kfac<T: Float + ScalarOperand>(
input: &Array2<T>,
gradients: &Array2<T>,
num_groups: usize,
) -> Result<Array2<T>>
pub fn grouped_conv_kfac<T: Float + ScalarOperand>( input: &Array2<T>, gradients: &Array2<T>, num_groups: usize, ) -> Result<Array2<T>>
Compute K-FAC update for grouped convolution layers
Sourcepub fn eigenvalue_regularization<T: Float + Debug + Send + Sync + 'static>(
matrix: &Array2<T>,
min_eigenvalue: T,
) -> Array2<T>
pub fn eigenvalue_regularization<T: Float + Debug + Send + Sync + 'static>( matrix: &Array2<T>, min_eigenvalue: T, ) -> Array2<T>
Compute eigenvalue-based regularization
Sourcepub fn kronecker_product_approx<T: Float + Debug + Send + Sync + 'static>(
a: &Array2<T>,
b: &Array2<T>,
) -> Array2<T>
pub fn kronecker_product_approx<T: Float + Debug + Send + Sync + 'static>( a: &Array2<T>, b: &Array2<T>, ) -> Array2<T>
Compute Kronecker product approximation for two matrices
Sourcepub fn trace<T: Float + Debug + Send + Sync + 'static>(matrix: &Array2<T>) -> T
pub fn trace<T: Float + Debug + Send + Sync + 'static>(matrix: &Array2<T>) -> T
Compute trace of a matrix
Sourcepub fn frobenius_norm<T: Float + Sum>(matrix: &Array2<T>) -> T
pub fn frobenius_norm<T: Float + Sum>(matrix: &Array2<T>) -> T
Compute Frobenius norm of a matrix
Sourcepub fn matrices_approx_equal<T: Float + Debug + Send + Sync + 'static>(
a: &Array2<T>,
b: &Array2<T>,
tolerance: T,
) -> bool
pub fn matrices_approx_equal<T: Float + Debug + Send + Sync + 'static>( a: &Array2<T>, b: &Array2<T>, tolerance: T, ) -> bool
Check if two matrices are approximately equal
Sourcepub fn exponential_moving_average<T: Float + Debug + Send + Sync + 'static>(
current_value: T,
new_value: T,
decay: T,
) -> T
pub fn exponential_moving_average<T: Float + Debug + Send + Sync + 'static>( current_value: T, new_value: T, decay: T, ) -> T
Compute running average with exponential decay
Sourcepub fn clamp_eigenvalues<T: Float + Debug + Send + Sync + 'static>(
eigenvalues: &mut Array1<T>,
min_val: T,
max_val: T,
)
pub fn clamp_eigenvalues<T: Float + Debug + Send + Sync + 'static>( eigenvalues: &mut Array1<T>, min_val: T, max_val: T, )
Clamp eigenvalues to prevent numerical instability
Sourcepub fn condition_number_svd_approx<T: Float + Debug + Send + Sync + 'static>(
matrix: &Array2<T>,
) -> T
pub fn condition_number_svd_approx<T: Float + Debug + Send + Sync + 'static>( matrix: &Array2<T>, ) -> T
Compute condition number using singular values (approximation)
Auto Trait Implementations§
impl Freeze for KFACUtils
impl RefUnwindSafe for KFACUtils
impl Send for KFACUtils
impl Sync for KFACUtils
impl Unpin for KFACUtils
impl UnsafeUnpin for KFACUtils
impl UnwindSafe for KFACUtils
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.