This seemed to work only with L1Loss as criterion. I am wondering why is this the case?
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)