You don’t need to use torch.exp(loss) and can just calculate the running loss directly with your operation.
If your loss is negative, could you please check the target range, as it’s supposed to be in the range [0, 1]?