In my task, I want the final loss is the NLLLoss multiply the abs(real_label - output_label), that is:
loss = NLLLoss * abs(real_label - output_label), could anyone tell me how implement this?
Exactly as you suggest
final_loss = nll_loss * torch.abs(real_label - output_label)