Created
November 13, 2020 09:05
-
-
Save obeshor/faf49e9f3d68daff06169b3a4c02d068 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def generator_model(): | |
model = tf.keras.Sequential() | |
model.add(layers.Dense(4*4*512, use_bias=False, input_shape=(100,))) | |
model.add(layers.BatchNormalization()) | |
model.add(layers.LeakyReLU()) | |
model.add(layers.Reshape((4, 4, 512))) | |
assert model.output_shape == (None, 4, 4, 512) # Note: None is the batch size | |
model.add(layers.Conv2DTranspose(256, (5, 5), strides=(2, 2), padding='same', use_bias=False)) | |
assert model.output_shape == (None, 8, 8, 256) | |
model.add(layers.BatchNormalization()) | |
model.add(layers.LeakyReLU()) | |
model.add(layers.Conv2DTranspose(128, (5, 5), strides=(2, 2), padding='same', use_bias=False)) | |
assert model.output_shape == (None, 16, 16, 128) | |
model.add(layers.BatchNormalization()) | |
model.add(layers.LeakyReLU()) | |
model.add(layers.Conv2DTranspose(3, (5, 5), strides=(2, 2), padding='same', use_bias=False, activation='tanh')) | |
assert model.output_shape == (None, 32, 32, 3) | |
return model |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment