F.cross_entropy(results,labels,weight = torch.Tensor([3, 1, 9, 8]).cuda(),reduction="sum")/results.shape[0]
Out[13]: tensor(2.0683, device='cuda:0')
F.cross_entropy(results,labels,weight = torch.Tensor([3, 1, 9, 8]).cuda(),reduction="mean")
Out[14]: tensor(0.9643, device='cuda:0')

What am I missing? Why is this not equal? Its somehow connected to weighting but I did not figured out how…yet. Thanks.