<p>None that I know of.</p>

<p>Here are two examples of PyTorch implementation:</p>

<ul>
<li><p><a href="https://github.com/OpenNMT/OpenNMT-py/blob/e8622eb5c6117269bb3accd8eb6f66282b5e67d9/onmt/utils/loss.py#L186" rel="noreferrer"><code>LabelSmoothingLoss</code> module</a> in OpenNMT framework for machine translation</p></li>
<li><p><a href="https://github.com/jadore801120/attention-is-all-you-need-pytorch/blob/master/train.py#L38" rel="noreferrer"><code>attention-is-all-you-need-pytorch</code></a>, re-implementation of Google's <a href="https://arxiv.org/abs/1706.03762" rel="noreferrer">Attention is all you need paper</a></p></li>
</ul>
Label Smoothing in PyTorch
<p>I'm building a <code>ResNet-18</code> classification model for the <strong>Stanford Cars</strong> dataset using transfer learning. I would like to implement <a href="https://arxiv.org/pdf/1701.06548.pdf" rel="noreferrer">label smoothing</a> to penalize overconfident predictions and improve generalization.</p>
<p><code>TensorFlow</code> has a simple keyword argument in <a href="https://www.tensorflow.org/api_docs/python/tf/losses/softmax_cross_entropy" rel="noreferrer"><code>CrossEntropyLoss</code></a>. Has anyone built a similar function for <code>PyTorch</code> that I could plug-and-play with?</p>