From 53b13ff245eb49632e25f5f3dfa31957e87cedc3 Mon Sep 17 00:00:00 2001 From: Morvan Zhou Date: Thu, 11 May 2017 13:56:13 +1000 Subject: [PATCH] update --- README.md | 3 +++ tutorial-contents/406_conditional_GAN.py | 8 ++------ 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index 246178f..1f3b352 100644 --- a/README.md +++ b/README.md @@ -8,6 +8,9 @@
+** If you'd like to use Tensorflow, no worries, I made a new Tensorflow Tutorial just like PyTorch. Here is the link: + [https://github.com/MorvanZhou/Tensorflow-Tutorial](https://github.com/MorvanZhou/Tensorflow-Tutorial)** + # pyTorch Tutorials In these tutorials for pyTorch, we will build our first Neural Network and try to build some advanced Neural Network architectures developed recent years. diff --git a/tutorial-contents/406_conditional_GAN.py b/tutorial-contents/406_conditional_GAN.py index 065f665..d66e069 100644 --- a/tutorial-contents/406_conditional_GAN.py +++ b/tutorial-contents/406_conditional_GAN.py @@ -40,11 +40,6 @@ def artist_works_with_labels(): # painting from the famous artist (real targ return Variable(paintings), Variable(labels) -def G_ideas(): # the random ideas for generator to draw something - z = torch.randn(BATCH_SIZE, N_IDEAS) - return Variable(z) - - G = nn.Sequential( # Generator nn.Linear(N_IDEAS+1, 128), # random ideas (could from normal distribution) + class label nn.ReLU(), @@ -65,7 +60,8 @@ plt.ion() # something about continuous plotting plt.show() for step in range(10000): artist_paintings, labels = artist_works_with_labels() # real painting, label from artist - G_inputs = torch.cat((G_ideas(), labels), 1) + G_ideas = Variable(torch.randn(BATCH_SIZE, N_IDEAS)) # random ideas + G_inputs = torch.cat((G_ideas, labels), 1) # ideas with labels G_paintings = G(G_inputs) # fake painting w.r.t label from G D_inputs0 = torch.cat((artist_paintings, labels), 1) # all have their labels