Labels smoothing seems to be important regularization technique now and important component of Sequence-to-sequence networks.
Implementing labels smoothing is fairly simple. It requires, however, one-hot encoded labels to be passed to the cost function (smoothing is changing one and zero to slightly different values).
Is there any way to implement it in PyTorch? Could I use maybe some different loss function, that accepts one-hot vectors, or rewrite nn.functional.cross_entropy so that the gradient can be derived?
Or maybe any different ideas how to use labels smoothing not going into Tensorflow?