zoo/dcgan/dcgan_c.py
def generator(self, latent=100, height=28, channels=1):
        """ Construct the Generator
            latent   : dimension of latent space
            channels : number of channels
        """
        def stem(inputs):
            factor = height // 4
            x = self.Dense(inputs, 128 * factor * factor)
            x = self.ReLU(x)
            x = Reshape((factor, factor, 128))(x)
            return x
        
        def learner(x):
            x = self.Conv2DTranspose(x, 128, (3, 3), strides=2, padding='same')
            x = self.Conv2D(x, 128, (3, 3), padding="same")
            x = self.BatchNormalization(x, momentum=0.8)
            x = self.ReLU(x)
        
            x = self.Conv2DTranspose(x, 64, (3, 3), strides=2, padding='same')
            x = self.Conv2D(x, 64, (3, 3), padding="same")
            x = self.BatchNormalization(x, momentum=0.8)
            x = self.ReLU(x)
            return x
        
        def classifier(x):
            outputs = self.Conv2D(x, channels, (3, 3), activation='tanh', padding="same")
            return outputs
        
        # Construct the Generator
        inputs = Input(shape=(latent,))
        x = stem(inputs)
        x = learner(x)
        outputs = classifier(x)

        return Model(inputs, outputs)
 Construct the Generator
            latent   : dimension of latent space
            channels : number of channels
        
Construct the Generator
latent   : dimension of latent space
channels : number of channels
Construct the Generator latent : dimension of latent space channels : number of channels
def generator(self, latent=100, height=28, channels=1):
        def stem(inputs):
            factor = height // 4
            x = self.Dense(inputs, 128 * factor * factor)
            x = self.ReLU(x)
            x = Reshape((factor, factor, 128))(x)
            return x
        def learner(x):
            x = self.Conv2DTranspose(x, 128, (3, 3), strides=2, padding='same')
            x = self.Conv2D(x, 128, (3, 3), padding="same")
            x = self.BatchNormalization(x, momentum=0.8)
            x = self.ReLU(x)
            x = self.Conv2DTranspose(x, 64, (3, 3), strides=2, padding='same')
            x = self.Conv2D(x, 64, (3, 3), padding="same")
            x = self.BatchNormalization(x, momentum=0.8)
            x = self.ReLU(x)
            return x
        def classifier(x):
            outputs = self.Conv2D(x, channels, (3, 3), activation='tanh', padding="same")
            return outputs
        inputs = Input(shape=(latent,))
        x = stem(inputs)
        x = learner(x)
        outputs = classifier(x)
        return Model(inputs, outputs)
def generator ( self , latent = 100 , height = 28 , channels = 1 ) : def stem ( inputs ) : factor = height // 4 x = self . Dense ( inputs , 128 * factor * factor ) x = self . ReLU ( x ) x = Reshape ( ( factor , factor , 128 ) ) ( x ) return x def learner ( x ) : x = self . Conv2DTranspose ( x , 128 , ( 3 , 3 ) , strides = 2 , padding = 'same' ) x = self . Conv2D ( x , 128 , ( 3 , 3 ) , padding = "same" ) x = self . BatchNormalization ( x , momentum = 0.8 ) x = self . ReLU ( x ) x = self . Conv2DTranspose ( x , 64 , ( 3 , 3 ) , strides = 2 , padding = 'same' ) x = self . Conv2D ( x , 64 , ( 3 , 3 ) , padding = "same" ) x = self . BatchNormalization ( x , momentum = 0.8 ) x = self . ReLU ( x ) return x def classifier ( x ) : outputs = self . Conv2D ( x , channels , ( 3 , 3 ) , activation = 'tanh' , padding = "same" ) return outputs inputs = Input ( shape = ( latent , ) ) x = stem ( inputs ) x = learner ( x ) outputs = classifier ( x ) return Model ( inputs , outputs )
Construct the Generator
latent   : dimension of latent space
channels : number of channels
Construct the Generator latent : dimension of latent space channels : number of channels
""" Construct the Generator
            latent   : dimension of latent space
            channels : number of channels
        """ # Construct the Generator
self
latent
height
channels