pub struct AttentionTransferLoss {
pub beta: f64,
}Expand description
Attention transfer for distillation based on attention maps.
Fields§
§beta: f64Beta parameter for attention map normalization.
Implementations§
Source§impl AttentionTransferLoss
impl AttentionTransferLoss
Sourcepub fn new(beta: f64) -> Self
pub fn new(beta: f64) -> Self
Create a new attention transfer loss.
§Arguments
beta- Power for attention map normalization (typically 2.0)
Sourcepub fn compute_attention_loss(
&self,
student_attention: &ArrayView<'_, f64, Ix2>,
teacher_attention: &ArrayView<'_, f64, Ix2>,
) -> TrainResult<f64>
pub fn compute_attention_loss( &self, student_attention: &ArrayView<'_, f64, Ix2>, teacher_attention: &ArrayView<'_, f64, Ix2>, ) -> TrainResult<f64>
Auto Trait Implementations§
impl Freeze for AttentionTransferLoss
impl RefUnwindSafe for AttentionTransferLoss
impl Send for AttentionTransferLoss
impl Sync for AttentionTransferLoss
impl Unpin for AttentionTransferLoss
impl UnwindSafe for AttentionTransferLoss
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 more