Пример #1
0
 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
Пример #2
0
 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
Пример #3
0
 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
Пример #4
0
 def torgb(x, res):  # res = 2..resolution_log2
     lod = self.resolution_log2 - res
     with tf.variable_scope('Gen_Dec_ToRGB_lod%d' % lod):
         return apply_bias(conv2d(x,
                                  fmaps=self.num_channels,
                                  kernel=1,
                                  cf=self.channel_first),
                           cf=self.channel_first)
Пример #5
0
 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))