Skip to content

Instantly share code, notes, and snippets.

@vsay01
Created January 22, 2020 01:57
Show Gist options
  • Save vsay01/fedac78ec08cecd7b3b1bc471f7f0a6d to your computer and use it in GitHub Desktop.
Save vsay01/fedac78ec08cecd7b3b1bc471f7f0a6d to your computer and use it in GitHub Desktop.
Preprocessing, download and create loader from dataset
# Define a transform to normalize the data
transform = transforms.Compose([transforms.ToTensor(),
transforms.Normalize((0.5, 0.5, 0.5), (0.5, 0.5, 0.5))])
# Download and load the training data
trainset = datasets.FashionMNIST('F_MNIST_data/', download=True, train=True, transform=transform)
# Download and load the test data
testset = datasets.FashionMNIST('F_MNIST_data/', download=True, train=False, transform=transform)
loaders = {
'train' : torch.utils.data.DataLoader(trainset,batch_size = 64,shuffle=True),
'test' : torch.utils.data.DataLoader(testset,batch_size = 64,shuffle=True),
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment