def create_generate_model(self, b_size):
     """ create samping model in fig 1 and 3 in the paper """
     self.set_is_training(False)
     with tf.variable_scope('AE', reuse=tf.AUTO_REUSE):
         self._create_generate_input()
         # if self.z is not fed in, just sample from diagonal Gaussian
         self.z = ops.tf_sample_standard_diag_guassian(b_size, self.n_code)
         decoder_in = self.z
         self.layers['generate'] = (self.decoder(decoder_in) + 1.) / 2.
    def create_generate_style_model(self, n_sample):
        """ create samping model in fig 6 in the paper """
        self.set_is_training(False)
        with tf.variable_scope('AE', reuse=tf.AUTO_REUSE):
            self._create_generate_input()
            label = []
            for i in range(self.n_class):
                label.extend([i for k in range(n_sample)])
            label = tf.convert_to_tensor(label) # [n_class]
            one_hot_label = tf.one_hot(label, self.n_class) # [n_class*n_sample, n_class]

            z = ops.tf_sample_standard_diag_guassian(n_sample, self.n_code)
            z = tf.tile(z, [self.n_class, 1]) # [n_class*n_sample, n_code]
            decoder_in = tf.concat((z, one_hot_label), axis=-1)
            self.layers['generate'] = (self.decoder(decoder_in) + 1. ) / 2.
Beispiel #3
0
 def create_generate_model(self, b_size):
     self.set_is_training(False)
     self._create_generate_input()
     self.z = ops.tf_sample_standard_diag_guassian(b_size, self._n_code)
     self.layers['generate'] = tf.nn.sigmoid(self.decoder(self.z))