def Q(x, reuse=False): with tf.variable_scope('infer', reuse=reuse): feamap0 = lrelu( conv2d(x, channelne[1], k=kersizee[0], s=1, name="conv2d_0")) feamap1 = block_down(feamap0, channelne[1], k=kersizee[1], s=1, name='block1') # 32x32 feamap2 = resblock_down(feamap1, channelne[2], k=kersizee[2], s=1, name='block2') # 16x16 feamap3 = block_down(feamap2, channelne[3], k=kersizee[3], s=1, name='block3') # 8x8 feamap4 = block_down(feamap3, channelne[4], k=kersizee[4], s=1, name='block4') # 4x4 #feamap5 = lrelu(conv2d(feamap4, channelne[5],k=kersizee[4], s=1,name="conv2d_5")) # 4x4 #feamap5 = lrelu(conv2d(feamap5, channelne[5],k=4, s=1,padding='VALID',name="conv2d_6")) # 1x1 feamap5 = tf.reshape(feamap4, [BATCH_SIZE, channelne[5] * fme[5] * fme[5]]) za = tf.nn.tanh(dense(feamap5, z_dim, gain=1, name='fully_f1')) return za
def descriptor(x, reuse=False): with tf.variable_scope('des', reuse=reuse): feamap0 = lrelu( conv2d(x, channelndes[1], k=kersizedes[0], s=1, name="conv2d_0")) feamap1 = block_down(feamap0, channelndes[1], k=kersizedes[1], s=1, name='block1') # 32x32 feamap2 = resblock_down(feamap1, channelndes[2], k=kersizedes[2], s=1, name='block2') # 16x16 feamap3 = block_down(feamap2, channelndes[3], k=kersizedes[3], s=1, name='block3') # 8x8 feamap4 = block_down(feamap3, channelndes[4], k=kersizedes[4], s=1, name='block4') # 4x4 feamap4 = minibatch_stddev_layer(feamap4, 10) feamap5 = lrelu( conv2d(feamap4, channelndes[5], k=kersizedes[4], s=1, name="conv2d_5")) # 4x4 #feamap5 = lrelu(conv2d(feamap5, channelndes[5],k=4, s=1,padding='VALID',name="conv2d_6")) # 1x1 feamap5 = tf.reshape( feamap5, [BATCH_SIZE, channelndes[5] * fmdes[5] * fmdes[5]]) out = dense(feamap5, 1, gain=1, name='fully_f') return out