Anyway, I think of it as being: exp mismatch between prediction and actual , where exp mismatch is used to strongly amplify being wrong.
Your model has a single floating-point output.
Depending on your problem, some other loss function might work better.
Is there a simple way to implement my own exponential function.
Then: import torch def myExpLoss logits, labels : return 2.
Why do you multiply the labels times 2.
And if you use normal tensor operations, autograd will work for you.