Nll_loss, in crossEntropyloss ,Target -1 is out of bounds error

Hi Chriseven!

The output of your model, [value1, value2], means whatever you
trained your model for it to mean.

As I understand it, you have structured your model as a two-class
multi-class classifier. (Your model outputs two values, and you use
CrossEntropyLoss.) Conceptually (although not in implementation)
this is the same as a binary-classification problem. (One output value,
and BCEWithLogitsLoss.)

The following post answers your question, but in the language of a
binary-classification problem:

Best.

K. Frank

1 Like