MCPcopy Create free account
hub / github.com/KeepTryingTo/Pytorch-GAN / saveImage

Function saveImage

fc-CGANCode/utils.py:17–26  ·  view source on GitHub ↗
(generator,epoch,)

Source from the content-addressed store, hash-verified

15
16
17def saveImage(generator,epoch,):
18 noise = torch.randn(size = (16,config.LATENT_DIM)).to(config.DEVICE)
19 # fixed labels
20 y_ = (torch.rand(16, 1) * config.NUM_CLASSES).type(torch.LongTensor)
21 y_fixed = torch.zeros(16, config.NUM_CLASSES)
22 y_fixed = y_fixed.scatter_(1, y_.view(16, 1), 1)
23
24 gen_imgs = generator(noise, y_fixed).view(-1, config.CHANNELS,config.IMG_SIZE,config.IMG_SIZE)
25
26 save_image(gen_imgs.data, 'save' + '/%d.png' % (epoch))
27
28
29def gradient_penalty(critic, real, fake, device):

Callers 1

mainFunction · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected