Skip to content

Instantly share code, notes, and snippets.

@johnolafenwa
Last active April 26, 2018 21:16
Show Gist options
  • Save johnolafenwa/7f5262c9680e02ba796d5ce249c5b1a5 to your computer and use it in GitHub Desktop.
Save johnolafenwa/7f5262c9680e02ba796d5ce249c5b1a5 to your computer and use it in GitHub Desktop.
# Define transformations for the test set
test_transformations = transforms.Compose([
transforms.ToTensor(),
transforms.Normalize((0.5, 0.5, 0.5), (0.5, 0.5, 0.5))
])
# Load the test set, note that train is set to False
test_set = CIFAR10(root="./data", train=False, transform=test_transformations, download=True)
# Create a loder for the test set, note that both shuffle is set to false for the test loader
test_loader = DataLoader(test_set, batch_size=32, shuffle=False, num_workers=4)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment