谷歌“史上最强GAN”,现在有了PyTorch预训练版,可直接玩耍 | 代码( 五 )

23class_vector = class_vector.to('cuda')

24model.to('cuda')

25

26# Generate an image

27with torch.no_grad():

28 output = model(noise_vector, class_vector, truncation)

29

30# If you have a GPU put back on CPU

31output = output.to('cpu')

32

33# If you have a sixtel compatible terminal you can display the images in the terminal

34# (see https://github.com/saitoha/libsixel for details)

35display_in_terminal(output)

36

37# Save results as png images

推荐阅读