Skip to content

Instantly share code, notes, and snippets.

@omarsar
Created August 19, 2018 03:05
Show Gist options
  • Save omarsar/d87108810a2fb98f43cab38f4403632a to your computer and use it in GitHub Desktop.
Save omarsar/d87108810a2fb98f43cab38f4403632a to your computer and use it in GitHub Desktop.
import matplotlib.pyplot as plt
import numpy as np
# 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