Creating custom loss function

class CrossEntropyLoss(nn.Module):

def __init__(self):

def forward(self, logits, target):
    log_probabilities = F.log_softmax(logits, dim=-1)
    totloss = torch.mean(torch.sum(- target * log_probabilities, 1))
    return totloss

TypeError: init() takes 1 positional argument but 3 were given

Can anyone please please help me to fix this

Hi, can you put the line where you instanciate CrossEntropyLoss module in your code? thanks