Solved by ptrblck in post #7 
              
              
                The error in cell20/21 is created by the wrong usage of the labels tensor: 
img = img.to(device)
log_ps = model(img.unsqueeze(0))
test_loss = criterion(log_ps, labels)

While you are loading a single image and unsqueeze the batch dimension, which is fine, you are reusing labels from previous cells (…