def block_e(x,res): with tf.variable_scope('Gen_Enc%dx%d' % (2**res, 2**res)): with tf.variable_scope('Conv'): x = leaky_relu(batchnorm(apply_bias(conv2d(x, fmaps = nf(res-2), kernel = 3, cf = self.channel_first), cf = self.channel_first), cf = self.channel_first)) x = downscale2d(x, cf = self.channel_first) return x
def block_d(x,res): layers = [] with tf.variable_scope('Gen_Dec_%dx%d' % (2**res, 2**res)): x = upscale2d(x, cf = self.channel_first) with tf.variable_scope('Conv'): x = leaky_relu(batchnorm(apply_bias(conv2d(x, fmaps = nf(res-1), kernel = 3, cf = self.channel_first), cf = self.channel_first), cf = self.channel_first)) return x
def fromrgb(x, res): with tf.variable_scope('Gen_Enc_FromRGB_lod%d' % (self.resolution_log2 - res)): return leaky_relu( apply_bias(conv2d(x, fmaps=nf(res - 1), kernel=1, cf=self.channel_first), cf=self.channel_first))
def block(x,res): layers = [] with tf.variable_scope('Disc_%dx%d' % (2**res, 2**res)): if res > 4: with tf.variable_scope('Conv'): x = leaky_relu(batchnorm(apply_bias(conv2d(x, fmaps = nf(res-2), kernel = 3, cf = self.channel_first), cf = self.channel_first), cf = self.channel_first)) x = downscale2d(x, cf = self.channel_first) else: with tf.variable_scope('Patch'): x = tf.sigmoid(apply_bias(conv2d(x, fmaps = 1, kernel = 3, cf = self.channel_first), cf = self.channel_first)) return x