Last active
April 13, 2019 10:26
-
-
Save amineHY/2afce72fa043eddea403bb9ac64d0404 to your computer and use it in GitHub Desktop.
This code import the MNIST dataset in Python
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import torch | |
import torchvision.datasets as dsets | |
batch_size = 32 | |
# MNIST dataset | |
mnist_train = dsets.MNIST(root='MNIST_data/', | |
train=True, | |
transform=transforms.ToTensor(), | |
download=True) | |
mnist_test = dsets.MNIST(root='MNIST_data/', | |
train=False, | |
transform=transforms.ToTensor(), | |
download=True) | |
# dataset loader | |
data_loader = torch.utils.data.DataLoader(dataset=mnist_train, | |
batch_size=batch_size, | |
shuffle=True) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment