提交 2a7f59e7 编写于 作者: Z zchen0211

more gan

上级 e21dcc5b
......@@ -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))
```
<p align="center">
<img src="./dcgan.png" width = "90%" align="center"/><br/>
The original GAN paper.
</p>
# 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)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册