Created
April 28, 2018 12:36
-
-
Save nogawanogawa/e38ef71d07a27e4d40a3e322736d9abd to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Generator | |
def generator(inputgen, name="generator", reuse=None): | |
if reuse: | |
scope.reuse_variables() | |
with tf.variable_scope(name): | |
f = 7 | |
ks = 3 | |
pad_input = tf.pad(inputgen,[[0, 0], [ks, ks], [ks, ks], [0, 0]], "REFLECT") | |
x = conv2d(pad_input, ngf, f, f, 1, 1, 0.02,name="c1") | |
x = conv2d(x, ngf*2, ks, ks, 2, 2, 0.02,"SAME","c2") | |
x = conv2d(x, ngf*4, ks, ks, 2, 2, 0.02,"SAME","c3") | |
x = resnet_block(x, ngf*4, "r1") | |
x = resnet_block(x, ngf*4, "r2") | |
x = resnet_block(x, ngf*4, "r3") | |
x = resnet_block(x, ngf*4, "r4") | |
x = resnet_block(x, ngf*4, "r5") | |
x = resnet_block(x, ngf*4, "r6") | |
x = resnet_block(x, ngf*4, "r7") | |
x = resnet_block(x, ngf*4, "r8") | |
x = resnet_block(x, ngf*4, "r9") | |
x = general_deconv2d(x, [batch_size,128,128,ngf*2], ngf*2, ks, ks, 2, 2, 0.02,"SAME","c4") | |
x = general_deconv2d(x, [batch_size,256,256,ngf], ngf, ks, ks, 2, 2, 0.02,"SAME","c5") | |
x = conv2d(x, img_layer, f, f, 1, 1, 0.02,"SAME","c6",do_relu=False) | |
# Adding the tanh layer | |
x = tf.nn.tanh(x,"t1") | |
return x |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment