Optimization, Pytorch, Machine Learning, Deep Learning, Tensorboard.
below we have modified our loss implementation so that a single instance of torch.nn.NLLLoss is created in the init function. class CrossEntropyLoss(nn.Module): def __init__(self): super().__init__() self.weight = torch.Tensor([0.1]*num_classes).cuda() self.nll = torch.nn.NLLLoss(self.weight) def