I use CIFAR10 to train a CNN for classifying. I have made a mistake by set the image type as np.float32, and I use transforms.ToTensor() as a sequential transform. The behavior of model is weird. It behaves well in the first several epochs, but gave totally random output after a certain epoch. Finally it turns out that the reason is the wrong data type of training data.
I suggest that pytorch should raise error when the data type is mismatching (required is byte, but input is float). That will help those who do not take care of the docs of transforms.ToTensor().