my bad… It’s actually a multi class problem. I really wanted to simply the targets but messed up… Thank you. I’ll edit the question. By the way, i managed to solve it this way, for someone interested in the future.
 targets = targets.contiguous().view(-1)
 logfeat = F.log_softmax(inputs, dim=1)
 one_hot = torch.zeros_like(inputs).scatter(1, targets.view(-1, 1), float(1))
 smooth_target = torch.zeros_like(inputs).scatter(1, targets.view(-1, 1), self.smoothing)
 smooth_loss = (smooth_target * logfeat).sum(dim=1)
 return smooth_loss.mean()