when i use
train_transforms = torchvision.transforms.Compose([
torchvision.transforms.ToTensor(),
torchvision.transforms.Normalize((0.1307,), (0.3081,))
])
for loading MNIST dataset, it slows down learning even with mean = 0 and std = 1.
when i use
train_transforms = torchvision.transforms.Compose([
torchvision.transforms.ToTensor(),
torchvision.transforms.Normalize((0.1307,), (0.3081,))
])
for loading MNIST dataset, it slows down learning even with mean = 0 and std = 1.
The transformations are performed on CPU, and it doesn't matter if the mean/std are all zeros (BTW, don't set std to 0). To speed up the transform you have two options:
torch.utils.data.DataLoaderwith some arguments: for examplenum_workersspecifies how many CPU processes to use to transform the data. THere is alsopin_memorywhich will speed up the whole thing if you are using CUDA.