pub struct LabelSmoothingLoss {
pub epsilon: f64,
pub num_classes: usize,
}Expand description
Label smoothing cross-entropy loss.
Based on “Rethinking the Inception Architecture for Computer Vision” (Szegedy et al., 2016). Replaces hard 0/1 labels with smoothed distribution:
- True class: 1 - epsilon
- Other classes: epsilon / (num_classes - 1)
Fields§
§epsilon: f64Smoothing parameter (typically 0.1).
num_classes: usizeNumber of classes.
Implementations§
Source§impl LabelSmoothingLoss
impl LabelSmoothingLoss
Trait Implementations§
Source§impl Clone for LabelSmoothingLoss
impl Clone for LabelSmoothingLoss
Source§fn clone(&self) -> LabelSmoothingLoss
fn clone(&self) -> LabelSmoothingLoss
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for LabelSmoothingLoss
impl Debug for LabelSmoothingLoss
Source§impl Loss for LabelSmoothingLoss
impl Loss for LabelSmoothingLoss
Source§fn compute(
&self,
predictions: &ArrayView<'_, f64, Ix2>,
targets: &ArrayView<'_, f64, Ix2>,
) -> TrainResult<f64>
fn compute( &self, predictions: &ArrayView<'_, f64, Ix2>, targets: &ArrayView<'_, f64, Ix2>, ) -> TrainResult<f64>
Compute loss value.
Auto Trait Implementations§
impl Freeze for LabelSmoothingLoss
impl RefUnwindSafe for LabelSmoothingLoss
impl Send for LabelSmoothingLoss
impl Sync for LabelSmoothingLoss
impl Unpin for LabelSmoothingLoss
impl UnwindSafe for LabelSmoothingLoss
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> 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