LabelSmoothing
The LabelSmoothing is an instance of the pytorch nn.Module class. The LabelSmoothing class implements an adapted version of the label smoothing loss function [1].
- LabelSmoothing.__init__(size, smoothing=0.0)[source]
Implements label smoothing loss function
- Parameters:
size (int) – Number of labels
smoothing (float, default=0.0) – Smoothing factor to apply
Forward
The forward()
function takes actual output x
and target
output and computes the loss.
This method is also called from the __call__
method, i.e. when the object is called directly.
Reference
[1] Christian Szegedy, Vincent Vanhoucke, Sergey Ioffe, Jonathon Shlens, and Zbigniew Wojna. Rethinking the Inception Architecture for Computer Vision. In Proceedings of the IEEE conference on computer vision and pattern recognition (CVPR). [PDF]