Skip to content

Instantly share code, notes, and snippets.

@omarsar
Created August 31, 2019 13:50
Show Gist options
  • Save omarsar/1e3735aef70fb180c896291aa2232d16 to your computer and use it in GitHub Desktop.
Save omarsar/1e3735aef70fb180c896291aa2232d16 to your computer and use it in GitHub Desktop.
## functions to show an image
def imshow(img):
#img = img / 2 + 0.5 # unnormalize
npimg = img.numpy()
plt.imshow(np.transpose(npimg, (1, 2, 0)))
## get some random training images
dataiter = iter(trainloader)
images, labels = dataiter.next()
## show images
imshow(torchvision.utils.make_grid(images))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment