pub struct SelfDistillation { /* private fields */ }Expand description
Self-Distillation (Zhang et al., 2019).
Uses deeper layers to teach shallower layers within the same network.
Implementations§
Source§impl SelfDistillation
impl SelfDistillation
pub fn new(temperature: f32) -> Self
Sourcepub fn add_layer_pair(self, teacher_idx: usize, student_idx: usize) -> Self
pub fn add_layer_pair(self, teacher_idx: usize, student_idx: usize) -> Self
Add a layer pair (teacher_layer_idx, student_layer_idx). Teacher should be deeper (higher index) than student.
pub fn layer_pairs(&self) -> &[(usize, usize)]
Sourcepub fn layer_loss(&self, student_output: &[f32], teacher_output: &[f32]) -> f32
pub fn layer_loss(&self, student_output: &[f32], teacher_output: &[f32]) -> f32
Compute self-distillation loss for a layer pair.
Trait Implementations§
Source§impl Clone for SelfDistillation
impl Clone for SelfDistillation
Source§fn clone(&self) -> SelfDistillation
fn clone(&self) -> SelfDistillation
Returns a duplicate of the value. Read more
1.0.0§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 SelfDistillation
impl RefUnwindSafe for SelfDistillation
impl Send for SelfDistillation
impl Sync for SelfDistillation
impl Unpin for SelfDistillation
impl UnwindSafe for SelfDistillation
Blanket Implementations§
§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§unsafe fn clone_to_uninit(&self, dest: *mut u8)
unsafe fn clone_to_uninit(&self, dest: *mut u8)
🔬This is a nightly-only experimental API. (
clone_to_uninit)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