def discriminator(self, inpt, reuse, is_train):
"""
Build D for training or testing. If reuse if True, the input should be the output of generator
"""
with tf.variable_scope("discriminator"):
if reuse:
tf.get_variable_scope().reuse_variables()
net = conv2d(x=inpt, num_kernels=self.d_init, name="conv1", activation=lkrelu, padding="SAME",
alpha=0.02, is_train=is_train, stddv=self.stddv)
net = conv2d(x=net, num_kernels=self.d_init*2, name="conv2", activation=lkrelu, padding="SAME",
alpha=0.02, is_train=is_train, stddv=self.stddv)
net = conv2d(x=net, num_kernels=self.d_init*4, name="conv3", activation=lkrelu, padding="SAME",
alpha=0.02, is_train=is_train, stddv=self.stddv)
net = conv2d(x=net, num_kernels=self.d_init*8, name="conv4", activation=lkrelu, padding="SAME",
alpha=0.02, is_train=is_train, stddv=self.stddv)
net = dense_layer(x=net, num_neurons=1, name="output", activation=tf.identity, is_train=is_train,
stddv=self.stddv)
return net
评论列表
文章目录