Skip to content

Instantly share code, notes, and snippets.

@MortisHuang
Created July 25, 2019 05:14
Show Gist options
  • Save MortisHuang/9b4c73c760d788c0a57b372a1640590c to your computer and use it in GitHub Desktop.
Save MortisHuang/9b4c73c760d788c0a57b372a1640590c to your computer and use it in GitHub Desktop.
def generator():
""" Declare generator """
model = Sequential()
model.add(Dense(256, input_shape=(10,)))
model.add(LeakyReLU(alpha=0.2)) # 使用 LeakyReLU 激活函數
model.add(BatchNormalization(momentum=0.8)) # 使用 BatchNormalization 優化
model.add(Dense(512))
model.add(LeakyReLU(alpha=0.2))
model.add(BatchNormalization(momentum=0.8))
model.add(Dense(1024))
model.add(LeakyReLU(alpha=0.2))
model.add(BatchNormalization(momentum=0.8))
model.add(Dense(width * height * channels, activation='tanh'))
model.add(Reshape((width, height, channels)))
model.summary()
return model
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment