:param model: :return:
(model)
| 76 | return True |
| 77 | |
| 78 | def generagedImage(model): |
| 79 | """ |
| 80 | :param model: |
| 81 | :return: |
| 82 | """ |
| 83 | noise = torch.randn(size=(16, config.LATENT_DIM)).to(config.DEVICE) |
| 84 | # fixed labels |
| 85 | y_ = (torch.rand(16, 1) * config.NUM_CLASSES).type(torch.LongTensor) |
| 86 | y_fixed = torch.zeros(16, config.NUM_CLASSES) |
| 87 | y_fixed = y_fixed.scatter_(1, y_.view(16, 1), 1) |
| 88 | |
| 89 | gen_imgs = model(noise, y_fixed).view(-1, config.CHANNELS, config.IMG_SIZE, config.IMG_SIZE) |
| 90 | save_image(gen_imgs.data, 'cur.png') |
| 91 | |
| 92 | def loadModel(model,root): |
| 93 | """ |