Skip to content

Instantly share code, notes, and snippets.

@yvan
Created December 4, 2017 04:21
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save yvan/9aca6ec23340bf6b52ca7a56c3acb006 to your computer and use it in GitHub Desktop.
Save yvan/9aca6ec23340bf6b52ca7a56c3acb006 to your computer and use it in GitHub Desktop.
# create new noise to pass to the generator
noise = to_variable(torch.randn(batch_size, noise_dim, 1, 1))
# load the generator from epoch 90 of training
load_model = os.path.join(pokemon_models, 'generator_dec317_ep_%d' % 90)
generator_final = Generator()
generator_final.load_state_dict(torch.load(load_model))
generator_final.cuda()
# generate new monsters
fixed_imgs = generator_final(noise)
result = denorm_monsters(fixed_imgs.cpu().data)
result = make_grid(result)
result = transforms.Compose([transforms.ToPILImage()])(result)
# plot those monsters
plt.figure(figsize=(20,15))
plt.imshow(result)
plt.axis('off')
_ = plt.show()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment