def discriminator(self, x, Cc=128, f_h=5, f_w=5):
with tf.variable_scope("d_conv1",reuse=self.DO_SHARE):
conv1 = conv2d(x, self.C, Cc, f_h, f_w, 2, 2, bias=not self.Bn, padding='SAME') # H/2 x W/2
conv1 = lrelu(conv1)
with tf.variable_scope("d_conv2",reuse=self.DO_SHARE):
conv2 = conv2d(conv1, Cc, 2*Cc, f_h, f_w, 2, 2, bias=not self.Bn, padding='SAME') # H/4 x W/4
conv2 = lrelu(tcl.batch_norm(conv2)) if self.Bn else lrelu(conv2)
with tf.variable_scope("d_conv3",reuse=self.DO_SHARE):
conv3 = conv2d(conv2, 2*Cc, 4*Cc, f_h, f_w, 2, 2, bias=not self.Bn, padding='SAME') # H/8 x W/8
conv3 = lrelu(tcl.batch_norm(conv3)) if self.Bn else lrelu(conv3)
with tf.variable_scope("d_conv4",reuse=self.DO_SHARE):
conv4 = conv2d(conv3, 4*Cc, 8*Cc, f_h, f_w, 2, 2, bias=not self.Bn, padding='SAME') # H/16 x W/16
conv4 = lrelu(tcl.batch_norm(conv4)) if self.Bn else lrelu(conv4)
with tf.variable_scope("d_conv5",reuse=self.DO_SHARE):
conv5 = conv2d(conv4, 8*Cc, 1, 4, 4, 1, 1, bias=not self.Bn, padding='VALID') # 1 x 1
return tf.reshape(conv5, [-1, 1])
评论列表
文章目录