# python3

import util

import tensorflow as tf
from tensorflow import keras
from tensorflow.keras.models import Sequential
from tensorflow.keras.layers import Dense, Conv2D, Dropout, Flatten, LeakyReLU
from tensorflow.keras.layers import BatchNormalization
from tensorflow.keras.optimizers import Adam
from tensorflow.keras.initializers import RandomNormal, glorot_normal, VarianceScaling

# Discriminator model
def discriminator_model(in_shape=(32, 32, 3)):
    init = glorot_normal()
    model = Sequential()
    model.add(Conv2D(64, (3,3), padding='same', kernel_initializer=init, input_shape=in_shape))
#     model.add(BatchNormalization())
    model.add(LeakyReLU(alpha=0.2))
    # downsample
    model.add(Conv2D(128, (3,3), strides=(2,2), kernel_initializer=init, padding='same'))
#     model.add(BatchNormalization())
    model.add(LeakyReLU(alpha=0.2))
    # downsample
    model.add(Conv2D(128, (3,3), strides=(2,2), kernel_initializer=init, padding='same'))
#     model.add(BatchNormalization())
    model.add(LeakyReLU(alpha=0.2))
    # downsample
    model.add(Conv2D(256, (3,3), strides=(2,2), kernel_initializer=init, padding='same'))
#     model.add(BatchNormalization())
    model.add(LeakyReLU(alpha=0.2))
    # classifier
    model.add(Flatten())
    model.add(Dropout(0.4))
    model.add(Dense(1, activation='sigmoid'))
    # compile model
    model.compile(loss='binary_crossentropy',
                  optimizer=Adam(lr=2e-4, beta_1=0.5),
                  metrics=['accuracy'])
    return model

tensorflow.keras.layers.LeakyReLU tensorflow.keras.initializers.glorot_normal tensorflow.keras.layers.Dense tensorflow.keras.layers.Conv2D tensorflow.keras.optimizers.Adam tensorflow.keras.layers.Dropout tensorflow.keras.models.Sequential tensorflow.keras.layers.Flatten
[(15, 'tensorflow.keras.initializers.glorot_normal', 'glorot_normal', ([], {}), False, 'from tensorflow.keras.initializers import RandomNormal, glorot_normal, VarianceScaling\n'), (16, 'tensorflow.keras.models.Sequential', 'Sequential', ([], {}), False, 'from tensorflow.keras.models import Sequential\n'), (17, 'tensorflow.keras.layers.Conv2D', 'Conv2D', (['(64)', '(3, 3)'], {'padding': '"""same"""', 'kernel_initializer': 'init', 'input_shape': 'in_shape'}), False, 'from tensorflow.keras.layers import Dense, Conv2D, Dropout, Flatten, LeakyReLU\n'), (19, 'tensorflow.keras.layers.LeakyReLU', 'LeakyReLU', ([], {'alpha': '(0.2)'}), False, 'from tensorflow.keras.layers import Dense, Conv2D, Dropout, Flatten, LeakyReLU\n'), (21, 'tensorflow.keras.layers.Conv2D', 'Conv2D', (['(128)', '(3, 3)'], {'strides': '(2, 2)', 'kernel_initializer': 'init', 'padding': '"""same"""'}), False, 'from tensorflow.keras.layers import Dense, Conv2D, Dropout, Flatten, LeakyReLU\n'), (23, 'tensorflow.keras.layers.LeakyReLU', 'LeakyReLU', ([], {'alpha': '(0.2)'}), False, 'from tensorflow.keras.layers import Dense, Conv2D, Dropout, Flatten, LeakyReLU\n'), (25, 'tensorflow.keras.layers.Conv2D', 'Conv2D', (['(128)', '(3, 3)'], {'strides': '(2, 2)', 'kernel_initializer': 'init', 'padding': '"""same"""'}), False, 'from tensorflow.keras.layers import Dense, Conv2D, Dropout, Flatten, LeakyReLU\n'), (27, 'tensorflow.keras.layers.LeakyReLU', 'LeakyReLU', ([], {'alpha': '(0.2)'}), False, 'from tensorflow.keras.layers import Dense, Conv2D, Dropout, Flatten, LeakyReLU\n'), (29, 'tensorflow.keras.layers.Conv2D', 'Conv2D', (['(256)', '(3, 3)'], {'strides': '(2, 2)', 'kernel_initializer': 'init', 'padding': '"""same"""'}), False, 'from tensorflow.keras.layers import Dense, Conv2D, Dropout, Flatten, LeakyReLU\n'), (31, 'tensorflow.keras.layers.LeakyReLU', 'LeakyReLU', ([], {'alpha': '(0.2)'}), False, 'from tensorflow.keras.layers import Dense, Conv2D, Dropout, Flatten, LeakyReLU\n'), (33, 'tensorflow.keras.layers.Flatten', 'Flatten', ([], {}), False, 'from tensorflow.keras.layers import Dense, Conv2D, Dropout, Flatten, LeakyReLU\n'), (34, 'tensorflow.keras.layers.Dropout', 'Dropout', (['(0.4)'], {}), False, 'from tensorflow.keras.layers import Dense, Conv2D, Dropout, Flatten, LeakyReLU\n'), (35, 'tensorflow.keras.layers.Dense', 'Dense', (['(1)'], {'activation': '"""sigmoid"""'}), False, 'from tensorflow.keras.layers import Dense, Conv2D, Dropout, Flatten, LeakyReLU\n'), (38, 'tensorflow.keras.optimizers.Adam', 'Adam', ([], {'lr': '(0.0002)', 'beta_1': '(0.5)'}), False, 'from tensorflow.keras.optimizers import Adam\n')]