diff --git a/doc/design/dcgan.png b/doc/design/dcgan.png new file mode 100644 index 0000000000000000000000000000000000000000..15e8e290a111ff43900934341365cb4360d87d28 Binary files /dev/null and b/doc/design/dcgan.png differ diff --git a/doc/design/gan_api.md b/doc/design/gan_api.md index b5f37051c6566b2b74147dbac6738c2728aa6fbe..eb0bc1c003a13d7d3dccd1d3fda043d1681cce3a 100644 --- a/doc/design/gan_api.md +++ b/doc/design/gan_api.md @@ -6,9 +6,13 @@ GAN implementation, just a demo. from paddle.v2 as pd import numpy as np import logging - -X = pd.data(pd.float_vector(784)) ``` + +

+
+The original GAN paper. +

+ # Conditional-GAN should be a class. ### Class member function: the initializer. ```python @@ -21,7 +25,7 @@ class DCGAN(object): self.z_dim = z_dim # input noise dimension # define parameters of discriminators - self.D_W0 = pd.Variable(shape=[784, 128], data=pd.gaussian_normal_randomizer()) + self.D_W0 = pd.Variable(shape=[3,3, 1, 128], data=pd.gaussian_normal_randomizer()) self.D_b0 = pd.Variable(np.zeros(128)) # variable also support initialization using a numpy data self.D_W1 = pd.Variable(shape=[784, 128], data=pd.gaussian_normal_randomizer()) self.D_b1 = pd.Variable(np.zeros(128)) # variable also support initialization using a numpy data @@ -51,7 +55,7 @@ def generator(self, z, y = None): G_h0_bn = pd.batch_norm(G_h0) G_h0_relu = pd.relu(G_h0_bn) - G_h1 = pd.fc(G_h0_relu, self.G_w1, self.G_b1) + G_h1 = pd.deconv(G_h0_relu, self.G_w1, self.G_b1) G_h1_bn = pd.batch_norm(G_h1) G_h1_relu = pd.relu(G_h1_bn)