Skip to main content

cross_entropy_with_smoothing

Function cross_entropy_with_smoothing 

Source
pub fn cross_entropy_with_smoothing(
    logits: &Vector<f32>,
    target_idx: usize,
    epsilon: f32,
) -> f32
Expand description

Cross-entropy loss with label smoothing.

ONE PATH: Uses nn::functional::log_softmax_1d for numerical stability (UCBD §4).