Skip to content

Commit

Permalink
update: PGGAN in progress... v0.4.5.4
Browse files Browse the repository at this point in the history
- shorten dup
  • Loading branch information
kozistr committed May 4, 2018
1 parent 5b08f8e commit 29afc2c
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions PGGAN/pggan_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ def __init__(self, s, batch_size=16, input_height=128, input_width=128, input_ch
self.gf_dim = gf_dim

self.z_dim = z_dim
self.beta1 = 0. # 0 ??
self.beta1 = 0.
self.beta2 = .99
self.lr = lr
self.eps = epsilon
Expand Down Expand Up @@ -217,6 +217,13 @@ def generator(self, z, pg=1, pg_t=False, reuse=None):
def nf(n):
return min(1024 // (2 ** n), self.z_dim)

def block(x, fs, name="0"):
x = resize_nn(x, x.get_shape()[1] * 2)
x = conv2d(x, fs, k=3, s=1, name='gen_n_%s_conv2d-%d' % (name, x.get_shape()[1]))
x = tf.nn.leaky_relu(x)
x = pixel_norm(x)
return x

with tf.variable_scope("gen", reuse=reuse):
x = tf.reshape(z, [-1, 1, 1, nf(1)])
x = conv2d(x, nf(1), k=4, s=1, name='gen_n_1_conv2d')
Expand All @@ -234,15 +241,8 @@ def nf(n):
x_out = conv2d(x, 3, k=1, s=1, name='gen_out_conv2d-%d' % x.get_shape()[1]) # to RGB images
x_out = resize_nn(x_out, x_out.get_shape()[1] * 2) # up-sampling

x = resize_nn(x, x.get_shape()[1] * 2)
x = conv2d(x, nf(i + 1), k=3, s=1, name='gen_n_1_conv2d-%d' % x.get_shape()[1])
x = tf.nn.leaky_relu(x)
x = pixel_norm(x)

x = resize_nn(x, x.get_shape()[1] * 2)
x = conv2d(x, nf(i + 1), k=3, s=1, name='gen_n_2_conv2d-%d' % x.get_shape()[1])
x = tf.nn.leaky_relu(x)
x = pixel_norm(x)
x = block(x, nf(i + 1), name="1")
x = block(x, nf(i + 1), name="2")

x = conv2d(x, 3, k=1, s=1, name='gen_out_conv2d-%d' % x.get_shape()[1]) # to RGB images

Expand Down

0 comments on commit 29afc2c

Please sign in to comment.