amsharma:

This seemed to work only with L1Loss as criterion. I am wondering why is this the case?


This shouldn’t be the case, as I’m using nn.NLLLoss and it works on my machine.



 amsharma:

Also, for printing the test accuracy, after the if condition, what changes should I incorporate in order to make it compatible with multiple outputs that my network is producing? The inner loop of testing seems to break at test_loss = criterion(log_ps, labels)


This is expected, as your model returns 8 outputs. I don’t know, what these outputs represent, but I would assume your loss calculation should be the same as during training.