[SOLVED] NB Loss

Hello everyone,

I am still new to PyTorch and am trying to implement multi-output neural network. To be more precise, I want to predict the mean and disperson of two negative binomial distributions, therefore 4 outputs in total.

For this purpose, I have defined a network and a custom loss function, but I think something has gone awfully wrong because my loss can become arbitrarily small/negative and reaches NaN eventually.

Could someone give me a few hints?

EDIT: I found the mistake. The NLL loss was negative which is impossible for probability mass functions and this is because I mixed up plus/minus signs in my loss function…