Skip to content

NingAnMe/Label-Smoothing-for-CrossEntropyLoss-PyTorch

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 

Repository files navigation

Label-Smoothing-for-CrossEntropyLoss-PyTorch

add a Arg: label_smoothing for torch.nn.CrossEntropyLoss()

import torch

inputs = torch.randn(3, 5, requires_grad=True)
targets = torch.empty(3, dtype=torch.long).random_(5)

from label_smothing_cross_entropy_loss import LabelSmoothCrossEntropyLoss
loss_function = LabelSmoothCrossEntropyLoss(smoothing=0.3)
loss = loss_function(inputs, targets)

About

add a Arg: label_smoothing for torch.nn.CrossEntropyLoss()

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages