pub struct SpectralNormalization<T: FloatBounds> { /* private fields */ }Expand description
Spectral normalization for constraining the spectral norm of weight matrices
Implementations§
Source§impl<T: FloatBounds + ScalarOperand> SpectralNormalization<T>
impl<T: FloatBounds + ScalarOperand> SpectralNormalization<T>
Sourcepub fn new(power_iterations: usize, eps: T) -> Self
pub fn new(power_iterations: usize, eps: T) -> Self
Create a new spectral normalization instance
Sourcepub fn normalize_weights(&mut self, weights: &Array2<T>) -> Array2<T>
pub fn normalize_weights(&mut self, weights: &Array2<T>) -> Array2<T>
Apply spectral normalization to a weight matrix
Sourcepub fn get_spectral_norm(&mut self, weights: &Array2<T>) -> Twhere
T: ScalarOperand + Clone,
pub fn get_spectral_norm(&mut self, weights: &Array2<T>) -> Twhere
T: ScalarOperand + Clone,
Get the current estimate of the spectral norm
Trait Implementations§
Source§impl<T: Clone + FloatBounds> Clone for SpectralNormalization<T>
impl<T: Clone + FloatBounds> Clone for SpectralNormalization<T>
Source§fn clone(&self) -> SpectralNormalization<T>
fn clone(&self) -> SpectralNormalization<T>
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl<T: Debug + FloatBounds> Debug for SpectralNormalization<T>
impl<T: Debug + FloatBounds> Debug for SpectralNormalization<T>
Source§impl<T: FloatBounds + ScalarOperand> Default for SpectralNormalization<T>
impl<T: FloatBounds + ScalarOperand> Default for SpectralNormalization<T>
Auto Trait Implementations§
impl<T> Freeze for SpectralNormalization<T>where
T: Freeze,
impl<T> RefUnwindSafe for SpectralNormalization<T>where
T: RefUnwindSafe,
impl<T> Send for SpectralNormalization<T>
impl<T> Sync for SpectralNormalization<T>
impl<T> Unpin for SpectralNormalization<T>where
T: Unpin,
impl<T> UnsafeUnpin for SpectralNormalization<T>where
T: UnsafeUnpin,
impl<T> UnwindSafe for SpectralNormalization<T>where
T: UnwindSafe + 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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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 more