I used the following code to normalize the MNIST dataset, when I print the first sample, it fails to normalize as the max element is 255, not 1.
train_transform = transforms.Compose([
transforms.ToTensor(),
transforms.Normalize((0.1307,), (0.3081,))])
train_set = torchvision.datasets.MNIST(
root=data_dir, train=True, download=True, transform=train_transform)
When I check the range of the dataset input images:
print("min:%f max:%f" %(train_set.data.min(), train_set.data.max()))
output result:min:0.000000 max:255.000000
I was expecting [0, 1] instead, I don't know why that is. Is there something wrong?