I successfully used the following code to download the training and testing data of MNIST dataset, but I don’t understand how two things work:
1: train_data and test_data all got data from datasets.MNIST, but train_data got 60K data, test_data got another 10K data, which syntax differentiate the downloading of different data? Train=True/False is the button to switch that?
2: why test_data get 10K new data without saying download=True.
Here is the code:
train_data=torchvision.datasets.MNIST('../data', train=True, download=True,
transform=torchvision.transforms.Compose([
torchvision.transforms.ToTensor(),
torchvision.transforms.Normalize((0.1307,), (0.3081,))
]))
test_data=torchvision.datasets.MNIST('../data', train=False,
transform=torchvision.transforms.Compose([
torchvision.transforms.ToTensor(),
torchvision.transforms.Normalize((0.1307,), (0.3081,))
]))
Thanks.