Skip to content

Instantly share code, notes, and snippets.

@itsuncheng
Created July 26, 2020 04:02
Show Gist options
  • Select an option

  • Save itsuncheng/aaedf7d1e01e23d2ca6fada76558d564 to your computer and use it in GitHub Desktop.

Select an option

Save itsuncheng/aaedf7d1e01e23d2ca6fada76558d564 to your computer and use it in GitHub Desktop.
# Grab a batch of real images from the dataloader
real_batch = next(iter(dataloader))
# Plot the real images
plt.figure(figsize=(15,15))
plt.subplot(1,2,1)
plt.axis("off")
plt.title("Real Images")
plt.imshow(np.transpose(vutils.make_grid(real_batch[0].to(device)[:64], padding=5, normalize=True).cpu(),(1,2,0)))
# Plot the fake images from the last epoch
plt.subplot(1,2,2)
plt.axis("off")
plt.title("Fake Images")
plt.imshow(np.transpose(img_list[-1],(1,2,0)))
plt.show()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment