pub struct KnowledgeDistillationTrainer<T, S> { /* private fields */ }Expand description
Knowledge distillation trainer
Implementations§
Source§impl<T, S> KnowledgeDistillationTrainer<T, S>
impl<T, S> KnowledgeDistillationTrainer<T, S>
Sourcepub fn new(teacher: T, student: S, config: DistillationConfig) -> Result<Self>
pub fn new(teacher: T, student: S, config: DistillationConfig) -> Result<Self>
Create a new knowledge distillation trainer
Sourcepub fn compute_distillation_loss(
&self,
teacher_outputs: &TeacherOutputs,
student_outputs: &StudentOutputs,
hard_targets: Option<&Tensor>,
) -> Result<DistillationOutput>
pub fn compute_distillation_loss( &self, teacher_outputs: &TeacherOutputs, student_outputs: &StudentOutputs, hard_targets: Option<&Tensor>, ) -> Result<DistillationOutput>
Compute distillation loss
Sourcepub fn current_temperature(&self) -> f32
pub fn current_temperature(&self) -> f32
Get current temperature (useful for progressive distillation)
Sourcepub fn current_alpha(&self) -> f32
pub fn current_alpha(&self) -> f32
Get current alpha (useful for progressive distillation)
Auto Trait Implementations§
impl<T, S> Freeze for KnowledgeDistillationTrainer<T, S>
impl<T, S> RefUnwindSafe for KnowledgeDistillationTrainer<T, S>where
T: RefUnwindSafe,
S: RefUnwindSafe,
impl<T, S> Send for KnowledgeDistillationTrainer<T, S>
impl<T, S> Sync for KnowledgeDistillationTrainer<T, S>
impl<T, S> Unpin for KnowledgeDistillationTrainer<T, S>
impl<T, S> UnsafeUnpin for KnowledgeDistillationTrainer<T, S>where
T: UnsafeUnpin,
S: UnsafeUnpin,
impl<T, S> UnwindSafe for KnowledgeDistillationTrainer<T, S>where
T: UnwindSafe,
S: UnwindSafe,
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> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
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