ptrblck:

labels = labels.squeeze()


Yes, I tried to print the standard way of loading MNIST dataset, yes, indeed the label size is
torch.Size([100]).
After I added the code “labels = labels.squeeze()” , it works!!!
I really appreciate your help!!