May 2019
Intermediate to advanced
452 pages
12h 16m
English
For our first PyTorch program, we are going to test downloading CIFAR-10 according to the official PyTorch documentation. As we did with TensorFlow, we again download both the training and test datasets. Here is a related part of the code that we are going to use in the next section:
import torchimport torchvisionimport torchvision.transforms as transformsnormalize = transforms.Compose( [transforms.ToTensor(), transforms.Normalize((0.5, 0.5, 0.5), (0.5, 0.5, 0.5))])trainset = torchvision.datasets.CIFAR10(root='./pytorch', train=True, download=True, transform=normalize)
The new dataset files will be downloaded to the same location where you ran the preceding code. root='./pytorch' is how you can customize ...
Read now
Unlock full access