We can't find the internet
Attempting to reconnect
Something went wrong!
Attempting to reconnect
← Loss Functions step 5 of 8
Easy
Research
Label Smoothing
Implement label smoothing from “Rethinking the Inception Architecture” (Szegedy et al., 2016).
Label smoothing replaces hard one-hot targets with soft targets to prevent overconfidence:
$$y_i' = (1 - \epsilon) \cdot y_i + \frac{\epsilon}{K}$$
Where:
- $y_i$ is the original one-hot label
- $\epsilon$ is the smoothing factor
- $K$ is the number of classes
Given:
-
labels: shape(batch,)— integer class labels -
n_classes: integer K -
epsilon: float smoothing factor
Output: Tensor of shape (batch, n_classes) — smoothed label distribution.
Nothing accepted yet. When a submission passes, the code that passed shows up
here, one entry per mode.
Stuck?
PyTorch reference solution
Sign in to attempt this problem and reveal the reference solution.