Accompanying code examples of the book "Introduction to Artificial Neural Networks and Deep Learning: A Practical Guide with Applications in Python" by Sebastian Raschka. All code examples are released under the MIT license. If you find this content useful, please consider supporting the work by buying a copy of the book.

Other code examples and content are available on GitHub. The PDF and ebook versions of the book are available through Leanpub.

In [1]:
%load_ext watermark
%watermark -a 'Sebastian Raschka' -v -p tensorflow
Sebastian Raschka 

CPython 3.6.1
IPython 6.0.0

tensorflow 1.2.0

Model Zoo -- General Adversarial Networks

Implementation of General Adversarial Nets (GAN) where both the discriminator and generator are multi-layer perceptrons with one hidden layer only. In this example, the GAN generator was trained to generate MNIST images.

Uses

  • samples from a random normal distribution (range [-1, 1])
  • dropout
  • leaky relus
  • batch normalization [performs worse here]
  • separate batches for "fake" and "real" images (where the labels are 1 = real images, 0 = fake images)
  • MNIST images normalized to [-1, 1] range
  • generator with tanh output
In [2]:
import numpy as np
import tensorflow as tf
from tensorflow.examples.tutorials.mnist import input_data
import pickle as pkl

tf.test.gpu_device_name()
Out[2]:
'/gpu:0'
In [3]:
### Abbreviatiuons
# dis_*: discriminator network
# gen_*: generator network

########################
### Helper functions
########################

def leaky_relu(x, alpha=0.0001):
    return tf.maximum(alpha * x, x)


########################
### DATASET
########################

mnist = input_data.read_data_sets('MNIST_data')


#########################
### SETTINGS
#########################

# Hyperparameters
learning_rate = 0.001
training_epochs = 100
batch_size = 64
dropout_rate = 0.5

# Other settings
print_interval = 200

# Architecture
dis_input_size = 784
gen_input_size = 100

dis_hidden_size = 128
gen_hidden_size = 128


#########################
### GRAPH DEFINITION
#########################

g = tf.Graph()
with g.as_default():
    
    # Placeholders for settings
    dropout = tf.placeholder(tf.float32, shape=None, name='dropout')
    is_training = tf.placeholder(tf.bool, shape=None, name='is_training')
    
    # Input data
    dis_x = tf.placeholder(tf.float32, shape=[None, dis_input_size], name='discriminator_input') 
    gen_x = tf.placeholder(tf.float32, [None, gen_input_size], name='generator_input')


    ##################
    # Generator Model
    ##################

    with tf.variable_scope('generator'):
        # linear -> ~~batch norm~~ -> leaky relu -> dropout -> tanh output
        gen_hidden = tf.layers.dense(inputs=gen_x, units=gen_hidden_size,
                                      activation=None)
        #gen_hidden = tf.layers.batch_normalization(gen_hidden, training=is_training)
        gen_hidden = leaky_relu(gen_hidden)
        gen_hidden = tf.layers.dropout(gen_hidden, rate=dropout_rate)
        gen_logits = tf.layers.dense(inputs=gen_hidden, units=dis_input_size, 
                                     activation=None)
        gen_out = tf.tanh(gen_logits, 'generator_output')


    ######################
    # Discriminator Model
    ######################
    
    def build_discriminator_graph(input_x, reuse=None):
        # linear -> ~~batch norm~~ -> leaky relu -> dropout -> sigmoid output
        with tf.variable_scope('discriminator', reuse=reuse):
            hidden = tf.layers.dense(inputs=input_x, units=dis_hidden_size, 
                                     activation=None)
            #hidden = tf.layers.batch_normalization(hidden, training=is_training)
            hidden = leaky_relu(hidden)
            hidden = tf.layers.dropout(hidden, rate=dropout_rate)
            logits = tf.layers.dense(inputs=hidden, units=1, activation=None)
            out = tf.sigmoid(logits)
        return logits, out    

    # Create a discriminator for real data and a discriminator for fake data
    dis_real_logits, dis_real_out = build_discriminator_graph(dis_x, reuse=False)
    dis_fake_logits, dis_fake_out = build_discriminator_graph(gen_out, reuse=True)


    #####################################
    # Generator and Discriminator Losses
    #####################################
    
    # Two discriminator cost components: loss on real data + loss on fake data
    # Real data has class label 0, fake data has class label 1
    dis_real_loss = tf.nn.sigmoid_cross_entropy_with_logits(logits=dis_real_logits, 
                                                            labels=tf.zeros_like(dis_real_logits))
    dis_fake_loss = tf.nn.sigmoid_cross_entropy_with_logits(logits=dis_fake_logits, 
                                                            labels=tf.ones_like(dis_fake_logits))
    dis_cost = tf.add(tf.reduce_mean(dis_fake_loss), 
                      tf.reduce_mean(dis_real_loss), 
                      name='discriminator_cost')
 
    # Generator cost: difference between dis. prediction and label "0" for real images
    gen_loss = tf.nn.sigmoid_cross_entropy_with_logits(logits=dis_fake_logits,
                                                       labels=tf.zeros_like(dis_fake_logits))
    gen_cost = tf.reduce_mean(gen_loss, name='generator_cost')
    
    
    #########################################
    # Generator and Discriminator Optimizers
    #########################################
      
    dis_optimizer = tf.train.AdamOptimizer(learning_rate)
    dis_train_vars = tf.get_collection(tf.GraphKeys.GLOBAL_VARIABLES, scope='discriminator')
    dis_update_ops = tf.get_collection(tf.GraphKeys.UPDATE_OPS, scope='discriminator')
    
    with tf.control_dependencies(dis_update_ops): # required to upd. batch_norm params
        dis_train = dis_optimizer.minimize(dis_cost, var_list=dis_train_vars,
                                           name='train_discriminator')
    
    gen_optimizer = tf.train.AdamOptimizer(learning_rate)
    gen_train_vars = tf.get_collection(tf.GraphKeys.GLOBAL_VARIABLES, scope='generator')
    gen_update_ops = tf.get_collection(tf.GraphKeys.UPDATE_OPS, scope='generator')
    
    with tf.control_dependencies(gen_update_ops): # required to upd. batch_norm params
        gen_train = gen_optimizer.minimize(gen_cost, var_list=gen_train_vars,
                                           name='train_generator')
    
    # Saver to save session for reuse
    saver = tf.train.Saver()
Extracting MNIST_data/train-images-idx3-ubyte.gz
Extracting MNIST_data/train-labels-idx1-ubyte.gz
Extracting MNIST_data/t10k-images-idx3-ubyte.gz
Extracting MNIST_data/t10k-labels-idx1-ubyte.gz
In [4]:
##########################
### TRAINING & EVALUATION
##########################

with tf.Session(graph=g) as sess:
    sess.run(tf.global_variables_initializer())
    
    avg_costs = {'discriminator': [], 'generator': []}

    for epoch in range(training_epochs):
        dis_avg_cost, gen_avg_cost = 0., 0.
        total_batch = mnist.train.num_examples // batch_size

        for i in range(total_batch):
            
            batch_x, batch_y = mnist.train.next_batch(batch_size)
            batch_x = batch_x*2 - 1 # normalize
            batch_randsample = np.random.uniform(-1, 1, size=(batch_size, gen_input_size))
            
            # Train
            _, dc = sess.run(['train_discriminator', 'discriminator_cost:0'],
                             feed_dict={'discriminator_input:0': batch_x, 
                                        'generator_input:0': batch_randsample,
                                        'dropout:0': dropout_rate,
                                        'is_training:0': True})
            _, gc = sess.run(['train_generator', 'generator_cost:0'],
                             feed_dict={'generator_input:0': batch_randsample,
                                        'dropout:0': dropout_rate,
                                        'is_training:0': True})
            
            dis_avg_cost += dc
            gen_avg_cost += gc

            if not i % print_interval:
                print("Minibatch: %03d | Dis/Gen Cost:    %.3f/%.3f" % (i + 1, dc, gc))
                

        print("Epoch:     %03d | Dis/Gen AvgCost: %.3f/%.3f" % 
              (epoch + 1, dis_avg_cost / total_batch, gen_avg_cost / total_batch))
        
        avg_costs['discriminator'].append(dis_avg_cost / total_batch)
        avg_costs['generator'].append(gen_avg_cost / total_batch)
    
    
    saver.save(sess, save_path='./gan.ckpt')
Minibatch: 001 | Dis/Gen Cost:    1.780/0.862
Minibatch: 201 | Dis/Gen Cost:    0.066/3.259
Minibatch: 401 | Dis/Gen Cost:    0.070/2.861
Minibatch: 601 | Dis/Gen Cost:    0.029/4.033
Minibatch: 801 | Dis/Gen Cost:    0.046/4.097
Epoch:     001 | Dis/Gen AvgCost: 0.132/3.455
Minibatch: 001 | Dis/Gen Cost:    0.019/4.750
Minibatch: 201 | Dis/Gen Cost:    0.178/6.108
Minibatch: 401 | Dis/Gen Cost:    0.376/6.452
Minibatch: 601 | Dis/Gen Cost:    0.637/5.819
Minibatch: 801 | Dis/Gen Cost:    0.683/2.401
Epoch:     002 | Dis/Gen AvgCost: 0.484/4.612
Minibatch: 001 | Dis/Gen Cost:    1.679/1.947
Minibatch: 201 | Dis/Gen Cost:    1.910/2.279
Minibatch: 401 | Dis/Gen Cost:    0.314/6.992
Minibatch: 601 | Dis/Gen Cost:    2.658/2.182
Minibatch: 801 | Dis/Gen Cost:    1.541/3.430
Epoch:     003 | Dis/Gen AvgCost: 1.345/3.748
Minibatch: 001 | Dis/Gen Cost:    1.549/2.604
Minibatch: 201 | Dis/Gen Cost:    1.511/1.262
Minibatch: 401 | Dis/Gen Cost:    1.741/1.563
Minibatch: 601 | Dis/Gen Cost:    0.765/2.525
Minibatch: 801 | Dis/Gen Cost:    1.689/3.023
Epoch:     004 | Dis/Gen AvgCost: 1.433/2.474
Minibatch: 001 | Dis/Gen Cost:    0.466/4.496
Minibatch: 201 | Dis/Gen Cost:    1.259/2.413
Minibatch: 401 | Dis/Gen Cost:    2.494/1.687
Minibatch: 601 | Dis/Gen Cost:    1.594/2.020
Minibatch: 801 | Dis/Gen Cost:    0.865/2.784
Epoch:     005 | Dis/Gen AvgCost: 1.739/2.148
Minibatch: 001 | Dis/Gen Cost:    1.168/1.676
Minibatch: 201 | Dis/Gen Cost:    2.473/1.964
Minibatch: 401 | Dis/Gen Cost:    1.211/2.805
Minibatch: 601 | Dis/Gen Cost:    0.530/1.776
Minibatch: 801 | Dis/Gen Cost:    1.437/1.472
Epoch:     006 | Dis/Gen AvgCost: 1.203/1.873
Minibatch: 001 | Dis/Gen Cost:    1.515/1.205
Minibatch: 201 | Dis/Gen Cost:    1.286/1.904
Minibatch: 401 | Dis/Gen Cost:    3.037/1.770
Minibatch: 601 | Dis/Gen Cost:    3.007/0.651
Minibatch: 801 | Dis/Gen Cost:    1.275/1.222
Epoch:     007 | Dis/Gen AvgCost: 1.617/1.847
Minibatch: 001 | Dis/Gen Cost:    3.702/0.770
Minibatch: 201 | Dis/Gen Cost:    1.513/1.432
Minibatch: 401 | Dis/Gen Cost:    2.323/1.038
Minibatch: 601 | Dis/Gen Cost:    0.923/1.478
Minibatch: 801 | Dis/Gen Cost:    0.981/1.738
Epoch:     008 | Dis/Gen AvgCost: 1.583/1.475
Minibatch: 001 | Dis/Gen Cost:    1.755/1.464
Minibatch: 201 | Dis/Gen Cost:    2.534/0.682
Minibatch: 401 | Dis/Gen Cost:    1.389/2.116
Minibatch: 601 | Dis/Gen Cost:    1.794/1.148
Minibatch: 801 | Dis/Gen Cost:    0.885/1.312
Epoch:     009 | Dis/Gen AvgCost: 1.543/1.312
Minibatch: 001 | Dis/Gen Cost:    2.486/1.028
Minibatch: 201 | Dis/Gen Cost:    0.970/1.257
Minibatch: 401 | Dis/Gen Cost:    0.773/1.811
Minibatch: 601 | Dis/Gen Cost:    0.385/2.397
Minibatch: 801 | Dis/Gen Cost:    1.848/1.614
Epoch:     010 | Dis/Gen AvgCost: 1.300/1.457
Minibatch: 001 | Dis/Gen Cost:    0.750/2.874
Minibatch: 201 | Dis/Gen Cost:    1.350/1.093
Minibatch: 401 | Dis/Gen Cost:    1.555/1.231
Minibatch: 601 | Dis/Gen Cost:    3.670/0.780
Minibatch: 801 | Dis/Gen Cost:    0.989/1.421
Epoch:     011 | Dis/Gen AvgCost: 1.429/1.574
Minibatch: 001 | Dis/Gen Cost:    1.472/1.077
Minibatch: 201 | Dis/Gen Cost:    0.965/1.482
Minibatch: 401 | Dis/Gen Cost:    1.503/0.949
Minibatch: 601 | Dis/Gen Cost:    1.551/1.123
Minibatch: 801 | Dis/Gen Cost:    2.052/0.743
Epoch:     012 | Dis/Gen AvgCost: 1.483/1.288
Minibatch: 001 | Dis/Gen Cost:    1.124/2.665
Minibatch: 201 | Dis/Gen Cost:    1.834/1.620
Minibatch: 401 | Dis/Gen Cost:    2.035/0.633
Minibatch: 601 | Dis/Gen Cost:    1.142/1.386
Minibatch: 801 | Dis/Gen Cost:    0.931/1.347
Epoch:     013 | Dis/Gen AvgCost: 1.223/1.466
Minibatch: 001 | Dis/Gen Cost:    1.352/1.303
Minibatch: 201 | Dis/Gen Cost:    1.251/0.909
Minibatch: 401 | Dis/Gen Cost:    0.588/1.875
Minibatch: 601 | Dis/Gen Cost:    1.195/1.276
Minibatch: 801 | Dis/Gen Cost:    1.959/1.229
Epoch:     014 | Dis/Gen AvgCost: 1.338/1.501
Minibatch: 001 | Dis/Gen Cost:    2.029/1.585
Minibatch: 201 | Dis/Gen Cost:    1.142/1.855
Minibatch: 401 | Dis/Gen Cost:    0.551/2.388
Minibatch: 601 | Dis/Gen Cost:    0.890/1.969
Minibatch: 801 | Dis/Gen Cost:    1.226/2.037
Epoch:     015 | Dis/Gen AvgCost: 1.038/1.895
Minibatch: 001 | Dis/Gen Cost:    0.846/1.996
Minibatch: 201 | Dis/Gen Cost:    0.951/2.238
Minibatch: 401 | Dis/Gen Cost:    0.646/2.625
Minibatch: 601 | Dis/Gen Cost:    1.420/2.272
Minibatch: 801 | Dis/Gen Cost:    0.839/2.226
Epoch:     016 | Dis/Gen AvgCost: 1.055/2.257
Minibatch: 001 | Dis/Gen Cost:    1.169/3.084
Minibatch: 201 | Dis/Gen Cost:    1.032/2.305
Minibatch: 401 | Dis/Gen Cost:    0.854/2.547
Minibatch: 601 | Dis/Gen Cost:    1.745/2.899
Minibatch: 801 | Dis/Gen Cost:    0.884/2.722
Epoch:     017 | Dis/Gen AvgCost: 1.193/2.179
Minibatch: 001 | Dis/Gen Cost:    1.647/1.778
Minibatch: 201 | Dis/Gen Cost:    1.012/2.455
Minibatch: 401 | Dis/Gen Cost:    2.399/2.018
Minibatch: 601 | Dis/Gen Cost:    1.506/1.272
Minibatch: 801 | Dis/Gen Cost:    1.159/1.535
Epoch:     018 | Dis/Gen AvgCost: 1.253/2.117
Minibatch: 001 | Dis/Gen Cost:    0.806/2.746
Minibatch: 201 | Dis/Gen Cost:    1.285/1.397
Minibatch: 401 | Dis/Gen Cost:    0.913/2.332
Minibatch: 601 | Dis/Gen Cost:    0.708/2.289
Minibatch: 801 | Dis/Gen Cost:    1.048/1.899
Epoch:     019 | Dis/Gen AvgCost: 1.148/1.803
Minibatch: 001 | Dis/Gen Cost:    1.340/1.754
Minibatch: 201 | Dis/Gen Cost:    1.093/2.140
Minibatch: 401 | Dis/Gen Cost:    1.377/2.535
Minibatch: 601 | Dis/Gen Cost:    1.162/1.228
Minibatch: 801 | Dis/Gen Cost:    0.984/2.376
Epoch:     020 | Dis/Gen AvgCost: 1.226/2.420
Minibatch: 001 | Dis/Gen Cost:    1.079/1.913
Minibatch: 201 | Dis/Gen Cost:    2.455/1.342
Minibatch: 401 | Dis/Gen Cost:    0.878/1.877
Minibatch: 601 | Dis/Gen Cost:    0.826/3.046
Minibatch: 801 | Dis/Gen Cost:    0.529/2.150
Epoch:     021 | Dis/Gen AvgCost: 1.114/2.047
Minibatch: 001 | Dis/Gen Cost:    1.082/1.645
Minibatch: 201 | Dis/Gen Cost:    1.352/1.737
Minibatch: 401 | Dis/Gen Cost:    1.457/2.237
Minibatch: 601 | Dis/Gen Cost:    1.086/2.139
Minibatch: 801 | Dis/Gen Cost:    1.823/1.261
Epoch:     022 | Dis/Gen AvgCost: 1.078/2.121
Minibatch: 001 | Dis/Gen Cost:    1.016/2.645
Minibatch: 201 | Dis/Gen Cost:    1.269/2.270
Minibatch: 401 | Dis/Gen Cost:    0.908/2.490
Minibatch: 601 | Dis/Gen Cost:    0.631/2.977
Minibatch: 801 | Dis/Gen Cost:    0.711/2.269
Epoch:     023 | Dis/Gen AvgCost: 1.135/2.395
Minibatch: 001 | Dis/Gen Cost:    1.876/1.551
Minibatch: 201 | Dis/Gen Cost:    1.449/1.323
Minibatch: 401 | Dis/Gen Cost:    1.326/1.785
Minibatch: 601 | Dis/Gen Cost:    1.094/1.926
Minibatch: 801 | Dis/Gen Cost:    1.580/1.551
Epoch:     024 | Dis/Gen AvgCost: 1.148/1.906
Minibatch: 001 | Dis/Gen Cost:    1.547/2.018
Minibatch: 201 | Dis/Gen Cost:    0.587/1.753
Minibatch: 401 | Dis/Gen Cost:    1.093/1.905
Minibatch: 601 | Dis/Gen Cost:    1.033/1.952
Minibatch: 801 | Dis/Gen Cost:    0.987/2.111
Epoch:     025 | Dis/Gen AvgCost: 1.074/1.919
Minibatch: 001 | Dis/Gen Cost:    1.711/1.559
Minibatch: 201 | Dis/Gen Cost:    1.470/1.704
Minibatch: 401 | Dis/Gen Cost:    1.069/1.374
Minibatch: 601 | Dis/Gen Cost:    1.040/1.915
Minibatch: 801 | Dis/Gen Cost:    0.922/1.537
Epoch:     026 | Dis/Gen AvgCost: 1.185/1.801
Minibatch: 001 | Dis/Gen Cost:    1.688/2.127
Minibatch: 201 | Dis/Gen Cost:    1.263/1.580
Minibatch: 401 | Dis/Gen Cost:    1.947/0.997
Minibatch: 601 | Dis/Gen Cost:    0.979/1.529
Minibatch: 801 | Dis/Gen Cost:    1.179/1.490
Epoch:     027 | Dis/Gen AvgCost: 1.156/1.598
Minibatch: 001 | Dis/Gen Cost:    1.273/1.861
Minibatch: 201 | Dis/Gen Cost:    1.702/1.418
Minibatch: 401 | Dis/Gen Cost:    1.472/1.390
Minibatch: 601 | Dis/Gen Cost:    1.147/1.575
Minibatch: 801 | Dis/Gen Cost:    0.849/2.294
Epoch:     028 | Dis/Gen AvgCost: 1.115/1.854
Minibatch: 001 | Dis/Gen Cost:    1.560/1.145
Minibatch: 201 | Dis/Gen Cost:    0.648/2.577
Minibatch: 401 | Dis/Gen Cost:    0.645/2.612
Minibatch: 601 | Dis/Gen Cost:    0.903/1.885
Minibatch: 801 | Dis/Gen Cost:    0.784/2.444
Epoch:     029 | Dis/Gen AvgCost: 1.137/1.916
Minibatch: 001 | Dis/Gen Cost:    0.966/1.777
Minibatch: 201 | Dis/Gen Cost:    1.249/1.753
Minibatch: 401 | Dis/Gen Cost:    0.767/2.880
Minibatch: 601 | Dis/Gen Cost:    0.897/1.763
Minibatch: 801 | Dis/Gen Cost:    1.191/1.265
Epoch:     030 | Dis/Gen AvgCost: 1.102/1.748
Minibatch: 001 | Dis/Gen Cost:    1.146/1.354
Minibatch: 201 | Dis/Gen Cost:    0.921/1.424
Minibatch: 401 | Dis/Gen Cost:    0.741/2.104
Minibatch: 601 | Dis/Gen Cost:    1.539/1.229
Minibatch: 801 | Dis/Gen Cost:    0.957/1.799
Epoch:     031 | Dis/Gen AvgCost: 1.027/1.808
Minibatch: 001 | Dis/Gen Cost:    0.817/2.358
Minibatch: 201 | Dis/Gen Cost:    1.416/1.772
Minibatch: 401 | Dis/Gen Cost:    1.578/1.132
Minibatch: 601 | Dis/Gen Cost:    1.116/1.745
Minibatch: 801 | Dis/Gen Cost:    1.094/1.548
Epoch:     032 | Dis/Gen AvgCost: 1.083/1.917
Minibatch: 001 | Dis/Gen Cost:    1.120/1.830
Minibatch: 201 | Dis/Gen Cost:    1.236/1.777
Minibatch: 401 | Dis/Gen Cost:    0.895/2.129
Minibatch: 601 | Dis/Gen Cost:    1.260/1.245
Minibatch: 801 | Dis/Gen Cost:    1.356/1.709
Epoch:     033 | Dis/Gen AvgCost: 1.101/1.931
Minibatch: 001 | Dis/Gen Cost:    1.115/2.186
Minibatch: 201 | Dis/Gen Cost:    0.629/1.934
Minibatch: 401 | Dis/Gen Cost:    1.462/1.294
Minibatch: 601 | Dis/Gen Cost:    0.796/2.729
Minibatch: 801 | Dis/Gen Cost:    0.795/1.279
Epoch:     034 | Dis/Gen AvgCost: 1.032/1.978
Minibatch: 001 | Dis/Gen Cost:    1.145/2.304
Minibatch: 201 | Dis/Gen Cost:    0.834/1.598
Minibatch: 401 | Dis/Gen Cost:    0.788/1.847
Minibatch: 601 | Dis/Gen Cost:    0.525/2.520
Minibatch: 801 | Dis/Gen Cost:    0.603/2.462
Epoch:     035 | Dis/Gen AvgCost: 0.952/1.909
Minibatch: 001 | Dis/Gen Cost:    1.453/1.804
Minibatch: 201 | Dis/Gen Cost:    0.615/2.529
Minibatch: 401 | Dis/Gen Cost:    0.963/1.911
Minibatch: 601 | Dis/Gen Cost:    1.063/1.767
Minibatch: 801 | Dis/Gen Cost:    1.079/2.067
Epoch:     036 | Dis/Gen AvgCost: 1.008/1.913
Minibatch: 001 | Dis/Gen Cost:    0.899/1.768
Minibatch: 201 | Dis/Gen Cost:    1.426/1.211
Minibatch: 401 | Dis/Gen Cost:    0.635/2.328
Minibatch: 601 | Dis/Gen Cost:    0.848/1.690
Minibatch: 801 | Dis/Gen Cost:    1.112/1.951
Epoch:     037 | Dis/Gen AvgCost: 0.905/2.041
Minibatch: 001 | Dis/Gen Cost:    1.201/2.162
Minibatch: 201 | Dis/Gen Cost:    0.934/2.198
Minibatch: 401 | Dis/Gen Cost:    1.189/1.820
Minibatch: 601 | Dis/Gen Cost:    0.661/2.764
Minibatch: 801 | Dis/Gen Cost:    0.877/2.538
Epoch:     038 | Dis/Gen AvgCost: 0.926/2.152
Minibatch: 001 | Dis/Gen Cost:    0.790/2.876
Minibatch: 201 | Dis/Gen Cost:    0.961/2.681
Minibatch: 401 | Dis/Gen Cost:    1.004/1.591
Minibatch: 601 | Dis/Gen Cost:    1.159/1.871
Minibatch: 801 | Dis/Gen Cost:    1.143/2.435
Epoch:     039 | Dis/Gen AvgCost: 0.933/2.113
Minibatch: 001 | Dis/Gen Cost:    1.065/2.207
Minibatch: 201 | Dis/Gen Cost:    1.077/2.460
Minibatch: 401 | Dis/Gen Cost:    0.781/2.020
Minibatch: 601 | Dis/Gen Cost:    0.728/1.683
Minibatch: 801 | Dis/Gen Cost:    1.206/1.962
Epoch:     040 | Dis/Gen AvgCost: 0.892/2.155
Minibatch: 001 | Dis/Gen Cost:    0.843/2.610
Minibatch: 201 | Dis/Gen Cost:    0.554/2.574
Minibatch: 401 | Dis/Gen Cost:    1.033/2.384
Minibatch: 601 | Dis/Gen Cost:    0.915/1.953
Minibatch: 801 | Dis/Gen Cost:    0.902/2.436
Epoch:     041 | Dis/Gen AvgCost: 0.935/2.005
Minibatch: 001 | Dis/Gen Cost:    0.916/1.967
Minibatch: 201 | Dis/Gen Cost:    1.309/1.805
Minibatch: 401 | Dis/Gen Cost:    1.461/1.443
Minibatch: 601 | Dis/Gen Cost:    0.832/2.506
Minibatch: 801 | Dis/Gen Cost:    0.930/1.799
Epoch:     042 | Dis/Gen AvgCost: 0.940/2.052
Minibatch: 001 | Dis/Gen Cost:    0.744/2.433
Minibatch: 201 | Dis/Gen Cost:    1.209/1.894
Minibatch: 401 | Dis/Gen Cost:    1.025/1.804
Minibatch: 601 | Dis/Gen Cost:    0.947/1.629
Minibatch: 801 | Dis/Gen Cost:    1.111/1.628
Epoch:     043 | Dis/Gen AvgCost: 0.925/1.994
Minibatch: 001 | Dis/Gen Cost:    0.931/1.860
Minibatch: 201 | Dis/Gen Cost:    0.752/1.858
Minibatch: 401 | Dis/Gen Cost:    0.885/1.572
Minibatch: 601 | Dis/Gen Cost:    1.009/2.137
Minibatch: 801 | Dis/Gen Cost:    1.264/2.319
Epoch:     044 | Dis/Gen AvgCost: 0.921/1.975
Minibatch: 001 | Dis/Gen Cost:    1.392/1.757
Minibatch: 201 | Dis/Gen Cost:    0.931/1.696
Minibatch: 401 | Dis/Gen Cost:    0.783/1.908
Minibatch: 601 | Dis/Gen Cost:    0.870/2.053
Minibatch: 801 | Dis/Gen Cost:    0.740/1.557
Epoch:     045 | Dis/Gen AvgCost: 0.934/2.042
Minibatch: 001 | Dis/Gen Cost:    1.182/1.813
Minibatch: 201 | Dis/Gen Cost:    1.008/2.248
Minibatch: 401 | Dis/Gen Cost:    0.837/2.026
Minibatch: 601 | Dis/Gen Cost:    1.179/1.756
Minibatch: 801 | Dis/Gen Cost:    1.081/2.034
Epoch:     046 | Dis/Gen AvgCost: 0.961/1.948
Minibatch: 001 | Dis/Gen Cost:    1.200/1.684
Minibatch: 201 | Dis/Gen Cost:    0.906/1.725
Minibatch: 401 | Dis/Gen Cost:    1.183/1.658
Minibatch: 601 | Dis/Gen Cost:    0.877/1.721
Minibatch: 801 | Dis/Gen Cost:    1.005/1.636
Epoch:     047 | Dis/Gen AvgCost: 0.976/1.891
Minibatch: 001 | Dis/Gen Cost:    0.945/2.076
Minibatch: 201 | Dis/Gen Cost:    0.901/1.734
Minibatch: 401 | Dis/Gen Cost:    1.296/1.686
Minibatch: 601 | Dis/Gen Cost:    0.877/2.226
Minibatch: 801 | Dis/Gen Cost:    0.822/1.944
Epoch:     048 | Dis/Gen AvgCost: 0.954/2.047
Minibatch: 001 | Dis/Gen Cost:    1.072/2.026
Minibatch: 201 | Dis/Gen Cost:    0.849/1.691
Minibatch: 401 | Dis/Gen Cost:    1.091/1.309
Minibatch: 601 | Dis/Gen Cost:    1.221/1.640
Minibatch: 801 | Dis/Gen Cost:    0.963/1.691
Epoch:     049 | Dis/Gen AvgCost: 0.941/1.939
Minibatch: 001 | Dis/Gen Cost:    1.114/1.423
Minibatch: 201 | Dis/Gen Cost:    0.889/2.320
Minibatch: 401 | Dis/Gen Cost:    1.093/2.145
Minibatch: 601 | Dis/Gen Cost:    0.784/2.213
Minibatch: 801 | Dis/Gen Cost:    1.003/1.800
Epoch:     050 | Dis/Gen AvgCost: 0.950/1.983
Minibatch: 001 | Dis/Gen Cost:    0.800/2.230
Minibatch: 201 | Dis/Gen Cost:    1.005/1.369
Minibatch: 401 | Dis/Gen Cost:    0.768/2.523
Minibatch: 601 | Dis/Gen Cost:    0.948/1.971
Minibatch: 801 | Dis/Gen Cost:    0.822/2.065
Epoch:     051 | Dis/Gen AvgCost: 0.961/1.966
Minibatch: 001 | Dis/Gen Cost:    0.893/1.870
Minibatch: 201 | Dis/Gen Cost:    0.848/1.757
Minibatch: 401 | Dis/Gen Cost:    1.047/1.956
Minibatch: 601 | Dis/Gen Cost:    0.930/1.811
Minibatch: 801 | Dis/Gen Cost:    1.027/1.798
Epoch:     052 | Dis/Gen AvgCost: 0.908/1.939
Minibatch: 001 | Dis/Gen Cost:    0.943/1.934
Minibatch: 201 | Dis/Gen Cost:    0.583/2.514
Minibatch: 401 | Dis/Gen Cost:    0.845/2.194
Minibatch: 601 | Dis/Gen Cost:    0.999/1.895
Minibatch: 801 | Dis/Gen Cost:    0.908/1.761
Epoch:     053 | Dis/Gen AvgCost: 0.936/1.894
Minibatch: 001 | Dis/Gen Cost:    0.725/2.493
Minibatch: 201 | Dis/Gen Cost:    1.008/2.450
Minibatch: 401 | Dis/Gen Cost:    1.354/1.257
Minibatch: 601 | Dis/Gen Cost:    0.807/1.977
Minibatch: 801 | Dis/Gen Cost:    0.902/1.763
Epoch:     054 | Dis/Gen AvgCost: 0.930/1.894
Minibatch: 001 | Dis/Gen Cost:    0.717/2.591
Minibatch: 201 | Dis/Gen Cost:    0.953/1.853
Minibatch: 401 | Dis/Gen Cost:    0.940/2.419
Minibatch: 601 | Dis/Gen Cost:    1.136/1.866
Minibatch: 801 | Dis/Gen Cost:    1.210/1.742
Epoch:     055 | Dis/Gen AvgCost: 0.923/1.924
Minibatch: 001 | Dis/Gen Cost:    0.733/2.124
Minibatch: 201 | Dis/Gen Cost:    1.186/1.780
Minibatch: 401 | Dis/Gen Cost:    0.827/1.658
Minibatch: 601 | Dis/Gen Cost:    0.762/2.223
Minibatch: 801 | Dis/Gen Cost:    0.815/1.968
Epoch:     056 | Dis/Gen AvgCost: 0.940/1.907
Minibatch: 001 | Dis/Gen Cost:    0.845/1.792
Minibatch: 201 | Dis/Gen Cost:    0.955/2.223
Minibatch: 401 | Dis/Gen Cost:    0.990/1.642
Minibatch: 601 | Dis/Gen Cost:    0.898/1.826
Minibatch: 801 | Dis/Gen Cost:    0.859/1.895
Epoch:     057 | Dis/Gen AvgCost: 0.927/1.862
Minibatch: 001 | Dis/Gen Cost:    0.781/2.240
Minibatch: 201 | Dis/Gen Cost:    1.101/1.946
Minibatch: 401 | Dis/Gen Cost:    1.187/2.024
Minibatch: 601 | Dis/Gen Cost:    0.905/1.966
Minibatch: 801 | Dis/Gen Cost:    1.126/1.619
Epoch:     058 | Dis/Gen AvgCost: 0.954/1.853
Minibatch: 001 | Dis/Gen Cost:    0.845/1.845
Minibatch: 201 | Dis/Gen Cost:    0.788/1.867
Minibatch: 401 | Dis/Gen Cost:    1.123/1.690
Minibatch: 601 | Dis/Gen Cost:    1.035/2.213
Minibatch: 801 | Dis/Gen Cost:    0.979/2.110
Epoch:     059 | Dis/Gen AvgCost: 0.949/1.849
Minibatch: 001 | Dis/Gen Cost:    0.792/2.654
Minibatch: 201 | Dis/Gen Cost:    0.667/2.302
Minibatch: 401 | Dis/Gen Cost:    0.745/2.209
Minibatch: 601 | Dis/Gen Cost:    1.149/1.681
Minibatch: 801 | Dis/Gen Cost:    0.983/1.955
Epoch:     060 | Dis/Gen AvgCost: 0.959/1.866
Minibatch: 001 | Dis/Gen Cost:    1.127/1.601
Minibatch: 201 | Dis/Gen Cost:    1.102/1.860
Minibatch: 401 | Dis/Gen Cost:    0.662/2.358
Minibatch: 601 | Dis/Gen Cost:    0.943/1.183
Minibatch: 801 | Dis/Gen Cost:    1.309/1.384
Epoch:     061 | Dis/Gen AvgCost: 0.953/1.852
Minibatch: 001 | Dis/Gen Cost:    1.039/1.489
Minibatch: 201 | Dis/Gen Cost:    0.716/2.281
Minibatch: 401 | Dis/Gen Cost:    0.820/2.397
Minibatch: 601 | Dis/Gen Cost:    0.991/1.501
Minibatch: 801 | Dis/Gen Cost:    0.784/2.214
Epoch:     062 | Dis/Gen AvgCost: 0.950/1.820
Minibatch: 001 | Dis/Gen Cost:    1.269/1.457
Minibatch: 201 | Dis/Gen Cost:    1.163/2.043
Minibatch: 401 | Dis/Gen Cost:    1.165/1.743
Minibatch: 601 | Dis/Gen Cost:    0.872/1.554
Minibatch: 801 | Dis/Gen Cost:    1.132/1.946
Epoch:     063 | Dis/Gen AvgCost: 0.969/1.848
Minibatch: 001 | Dis/Gen Cost:    1.150/1.981
Minibatch: 201 | Dis/Gen Cost:    0.821/2.240
Minibatch: 401 | Dis/Gen Cost:    1.118/1.780
Minibatch: 601 | Dis/Gen Cost:    0.999/1.346
Minibatch: 801 | Dis/Gen Cost:    1.020/1.646
Epoch:     064 | Dis/Gen AvgCost: 0.997/1.795
Minibatch: 001 | Dis/Gen Cost:    0.830/2.187
Minibatch: 201 | Dis/Gen Cost:    1.153/1.105
Minibatch: 401 | Dis/Gen Cost:    0.947/1.664
Minibatch: 601 | Dis/Gen Cost:    0.985/2.092
Minibatch: 801 | Dis/Gen Cost:    1.170/1.618
Epoch:     065 | Dis/Gen AvgCost: 1.014/1.745
Minibatch: 001 | Dis/Gen Cost:    0.777/1.826
Minibatch: 201 | Dis/Gen Cost:    0.943/2.126
Minibatch: 401 | Dis/Gen Cost:    1.058/1.531
Minibatch: 601 | Dis/Gen Cost:    0.885/1.926
Minibatch: 801 | Dis/Gen Cost:    0.901/2.076
Epoch:     066 | Dis/Gen AvgCost: 1.026/1.729
Minibatch: 001 | Dis/Gen Cost:    0.839/1.736
Minibatch: 201 | Dis/Gen Cost:    1.021/1.997
Minibatch: 401 | Dis/Gen Cost:    1.019/1.796
Minibatch: 601 | Dis/Gen Cost:    1.079/1.548
Minibatch: 801 | Dis/Gen Cost:    1.064/1.670
Epoch:     067 | Dis/Gen AvgCost: 1.001/1.682
Minibatch: 001 | Dis/Gen Cost:    1.075/1.497
Minibatch: 201 | Dis/Gen Cost:    1.083/1.696
Minibatch: 401 | Dis/Gen Cost:    0.947/1.769
Minibatch: 601 | Dis/Gen Cost:    1.005/1.833
Minibatch: 801 | Dis/Gen Cost:    0.782/2.193
Epoch:     068 | Dis/Gen AvgCost: 0.983/1.744
Minibatch: 001 | Dis/Gen Cost:    1.152/1.972
Minibatch: 201 | Dis/Gen Cost:    1.032/1.782
Minibatch: 401 | Dis/Gen Cost:    0.850/1.932
Minibatch: 601 | Dis/Gen Cost:    0.726/2.192
Minibatch: 801 | Dis/Gen Cost:    0.817/2.106
Epoch:     069 | Dis/Gen AvgCost: 0.988/1.737
Minibatch: 001 | Dis/Gen Cost:    0.824/1.608
Minibatch: 201 | Dis/Gen Cost:    0.998/1.683
Minibatch: 401 | Dis/Gen Cost:    0.725/2.099
Minibatch: 601 | Dis/Gen Cost:    1.142/1.952
Minibatch: 801 | Dis/Gen Cost:    0.984/1.919
Epoch:     070 | Dis/Gen AvgCost: 0.998/1.747
Minibatch: 001 | Dis/Gen Cost:    0.883/1.957
Minibatch: 201 | Dis/Gen Cost:    1.178/1.769
Minibatch: 401 | Dis/Gen Cost:    1.189/1.297
Minibatch: 601 | Dis/Gen Cost:    1.033/1.601
Minibatch: 801 | Dis/Gen Cost:    0.939/1.494
Epoch:     071 | Dis/Gen AvgCost: 1.001/1.694
Minibatch: 001 | Dis/Gen Cost:    1.127/2.006
Minibatch: 201 | Dis/Gen Cost:    1.451/1.442
Minibatch: 401 | Dis/Gen Cost:    0.867/1.620
Minibatch: 601 | Dis/Gen Cost:    0.832/1.606
Minibatch: 801 | Dis/Gen Cost:    0.829/1.446
Epoch:     072 | Dis/Gen AvgCost: 1.011/1.652
Minibatch: 001 | Dis/Gen Cost:    1.061/1.443
Minibatch: 201 | Dis/Gen Cost:    1.061/1.460
Minibatch: 401 | Dis/Gen Cost:    1.148/1.710
Minibatch: 601 | Dis/Gen Cost:    1.292/1.098
Minibatch: 801 | Dis/Gen Cost:    0.763/1.917
Epoch:     073 | Dis/Gen AvgCost: 0.994/1.679
Minibatch: 001 | Dis/Gen Cost:    1.115/1.742
Minibatch: 201 | Dis/Gen Cost:    1.004/1.599
Minibatch: 401 | Dis/Gen Cost:    0.857/1.958
Minibatch: 601 | Dis/Gen Cost:    0.960/1.693
Minibatch: 801 | Dis/Gen Cost:    0.933/1.855
Epoch:     074 | Dis/Gen AvgCost: 0.998/1.711
Minibatch: 001 | Dis/Gen Cost:    0.994/1.530
Minibatch: 201 | Dis/Gen Cost:    1.066/1.401
Minibatch: 401 | Dis/Gen Cost:    1.183/1.350
Minibatch: 601 | Dis/Gen Cost:    0.774/1.700
Minibatch: 801 | Dis/Gen Cost:    0.879/1.804
Epoch:     075 | Dis/Gen AvgCost: 1.004/1.695
Minibatch: 001 | Dis/Gen Cost:    0.901/2.194
Minibatch: 201 | Dis/Gen Cost:    1.068/1.360
Minibatch: 401 | Dis/Gen Cost:    0.954/1.416
Minibatch: 601 | Dis/Gen Cost:    1.055/1.563
Minibatch: 801 | Dis/Gen Cost:    1.022/1.478
Epoch:     076 | Dis/Gen AvgCost: 1.015/1.655
Minibatch: 001 | Dis/Gen Cost:    0.928/1.833
Minibatch: 201 | Dis/Gen Cost:    0.859/1.379
Minibatch: 401 | Dis/Gen Cost:    0.904/1.730
Minibatch: 601 | Dis/Gen Cost:    0.885/1.659
Minibatch: 801 | Dis/Gen Cost:    1.044/1.927
Epoch:     077 | Dis/Gen AvgCost: 1.022/1.605
Minibatch: 001 | Dis/Gen Cost:    1.160/1.570
Minibatch: 201 | Dis/Gen Cost:    0.931/1.476
Minibatch: 401 | Dis/Gen Cost:    0.823/1.512
Minibatch: 601 | Dis/Gen Cost:    1.116/1.255
Minibatch: 801 | Dis/Gen Cost:    1.183/1.266
Epoch:     078 | Dis/Gen AvgCost: 1.026/1.650
Minibatch: 001 | Dis/Gen Cost:    1.629/0.871
Minibatch: 201 | Dis/Gen Cost:    1.250/1.815
Minibatch: 401 | Dis/Gen Cost:    0.970/1.700
Minibatch: 601 | Dis/Gen Cost:    1.197/1.494
Minibatch: 801 | Dis/Gen Cost:    0.900/1.601
Epoch:     079 | Dis/Gen AvgCost: 1.034/1.617
Minibatch: 001 | Dis/Gen Cost:    0.858/1.931
Minibatch: 201 | Dis/Gen Cost:    1.006/1.475
Minibatch: 401 | Dis/Gen Cost:    0.919/1.850
Minibatch: 601 | Dis/Gen Cost:    1.125/1.624
Minibatch: 801 | Dis/Gen Cost:    0.968/1.406
Epoch:     080 | Dis/Gen AvgCost: 1.009/1.686
Minibatch: 001 | Dis/Gen Cost:    0.773/2.030
Minibatch: 201 | Dis/Gen Cost:    1.064/1.797
Minibatch: 401 | Dis/Gen Cost:    0.832/1.732
Minibatch: 601 | Dis/Gen Cost:    1.010/1.615
Minibatch: 801 | Dis/Gen Cost:    0.969/1.654
Epoch:     081 | Dis/Gen AvgCost: 1.027/1.616
Minibatch: 001 | Dis/Gen Cost:    1.002/1.366
Minibatch: 201 | Dis/Gen Cost:    0.849/1.789
Minibatch: 401 | Dis/Gen Cost:    0.868/1.846
Minibatch: 601 | Dis/Gen Cost:    0.867/2.013
Minibatch: 801 | Dis/Gen Cost:    0.996/1.670
Epoch:     082 | Dis/Gen AvgCost: 1.022/1.660
Minibatch: 001 | Dis/Gen Cost:    0.807/1.946
Minibatch: 201 | Dis/Gen Cost:    0.941/2.055
Minibatch: 401 | Dis/Gen Cost:    1.230/1.317
Minibatch: 601 | Dis/Gen Cost:    0.973/1.707
Minibatch: 801 | Dis/Gen Cost:    0.875/2.133
Epoch:     083 | Dis/Gen AvgCost: 1.003/1.661
Minibatch: 001 | Dis/Gen Cost:    1.197/1.645
Minibatch: 201 | Dis/Gen Cost:    1.049/1.379
Minibatch: 401 | Dis/Gen Cost:    1.005/1.732
Minibatch: 601 | Dis/Gen Cost:    1.148/1.651
Minibatch: 801 | Dis/Gen Cost:    1.042/1.556
Epoch:     084 | Dis/Gen AvgCost: 1.026/1.665
Minibatch: 001 | Dis/Gen Cost:    1.112/1.451
Minibatch: 201 | Dis/Gen Cost:    0.870/2.034
Minibatch: 401 | Dis/Gen Cost:    0.983/1.714
Minibatch: 601 | Dis/Gen Cost:    1.010/1.791
Minibatch: 801 | Dis/Gen Cost:    0.874/1.963
Epoch:     085 | Dis/Gen AvgCost: 1.026/1.631
Minibatch: 001 | Dis/Gen Cost:    1.124/1.356
Minibatch: 201 | Dis/Gen Cost:    1.283/1.486
Minibatch: 401 | Dis/Gen Cost:    0.769/1.989
Minibatch: 601 | Dis/Gen Cost:    1.148/1.516
Minibatch: 801 | Dis/Gen Cost:    1.093/1.796
Epoch:     086 | Dis/Gen AvgCost: 1.032/1.603
Minibatch: 001 | Dis/Gen Cost:    1.169/1.242
Minibatch: 201 | Dis/Gen Cost:    1.099/1.615
Minibatch: 401 | Dis/Gen Cost:    1.027/1.576
Minibatch: 601 | Dis/Gen Cost:    0.879/2.036
Minibatch: 801 | Dis/Gen Cost:    0.998/1.492
Epoch:     087 | Dis/Gen AvgCost: 1.032/1.594
Minibatch: 001 | Dis/Gen Cost:    1.252/1.457
Minibatch: 201 | Dis/Gen Cost:    0.923/1.976
Minibatch: 401 | Dis/Gen Cost:    0.801/1.904
Minibatch: 601 | Dis/Gen Cost:    0.943/1.597
Minibatch: 801 | Dis/Gen Cost:    0.896/1.933
Epoch:     088 | Dis/Gen AvgCost: 1.016/1.639
Minibatch: 001 | Dis/Gen Cost:    1.161/1.404
Minibatch: 201 | Dis/Gen Cost:    0.913/1.878
Minibatch: 401 | Dis/Gen Cost:    0.874/1.717
Minibatch: 601 | Dis/Gen Cost:    0.996/1.397
Minibatch: 801 | Dis/Gen Cost:    0.812/1.427
Epoch:     089 | Dis/Gen AvgCost: 1.014/1.612
Minibatch: 001 | Dis/Gen Cost:    0.893/1.509
Minibatch: 201 | Dis/Gen Cost:    1.005/1.585
Minibatch: 401 | Dis/Gen Cost:    0.856/1.956
Minibatch: 601 | Dis/Gen Cost:    1.010/1.746
Minibatch: 801 | Dis/Gen Cost:    1.047/1.875
Epoch:     090 | Dis/Gen AvgCost: 1.025/1.643
Minibatch: 001 | Dis/Gen Cost:    1.080/1.830
Minibatch: 201 | Dis/Gen Cost:    1.377/1.294
Minibatch: 401 | Dis/Gen Cost:    1.259/1.133
Minibatch: 601 | Dis/Gen Cost:    1.072/1.199
Minibatch: 801 | Dis/Gen Cost:    0.921/2.191
Epoch:     091 | Dis/Gen AvgCost: 1.025/1.574
Minibatch: 001 | Dis/Gen Cost:    0.816/2.002
Minibatch: 201 | Dis/Gen Cost:    1.147/1.551
Minibatch: 401 | Dis/Gen Cost:    0.939/1.615
Minibatch: 601 | Dis/Gen Cost:    0.927/1.692
Minibatch: 801 | Dis/Gen Cost:    1.391/1.163
Epoch:     092 | Dis/Gen AvgCost: 1.026/1.647
Minibatch: 001 | Dis/Gen Cost:    0.821/2.085
Minibatch: 201 | Dis/Gen Cost:    0.929/1.393
Minibatch: 401 | Dis/Gen Cost:    0.878/1.617
Minibatch: 601 | Dis/Gen Cost:    1.245/1.325
Minibatch: 801 | Dis/Gen Cost:    1.040/1.512
Epoch:     093 | Dis/Gen AvgCost: 1.028/1.621
Minibatch: 001 | Dis/Gen Cost:    1.150/1.441
Minibatch: 201 | Dis/Gen Cost:    0.919/1.795
Minibatch: 401 | Dis/Gen Cost:    1.092/1.452
Minibatch: 601 | Dis/Gen Cost:    1.004/1.484
Minibatch: 801 | Dis/Gen Cost:    0.763/1.644
Epoch:     094 | Dis/Gen AvgCost: 1.048/1.578
Minibatch: 001 | Dis/Gen Cost:    1.226/1.486
Minibatch: 201 | Dis/Gen Cost:    1.084/1.420
Minibatch: 401 | Dis/Gen Cost:    1.137/1.446
Minibatch: 601 | Dis/Gen Cost:    1.286/1.335
Minibatch: 801 | Dis/Gen Cost:    1.102/1.262
Epoch:     095 | Dis/Gen AvgCost: 1.043/1.560
Minibatch: 001 | Dis/Gen Cost:    1.001/1.547
Minibatch: 201 | Dis/Gen Cost:    1.143/1.308
Minibatch: 401 | Dis/Gen Cost:    1.040/1.441
Minibatch: 601 | Dis/Gen Cost:    1.056/1.368
Minibatch: 801 | Dis/Gen Cost:    1.102/1.857
Epoch:     096 | Dis/Gen AvgCost: 1.042/1.605
Minibatch: 001 | Dis/Gen Cost:    0.990/1.628
Minibatch: 201 | Dis/Gen Cost:    1.153/1.578
Minibatch: 401 | Dis/Gen Cost:    1.261/1.422
Minibatch: 601 | Dis/Gen Cost:    1.132/1.440
Minibatch: 801 | Dis/Gen Cost:    1.113/1.186
Epoch:     097 | Dis/Gen AvgCost: 1.036/1.596
Minibatch: 001 | Dis/Gen Cost:    0.843/1.715
Minibatch: 201 | Dis/Gen Cost:    0.859/1.627
Minibatch: 401 | Dis/Gen Cost:    1.338/1.386
Minibatch: 601 | Dis/Gen Cost:    1.175/1.362
Minibatch: 801 | Dis/Gen Cost:    0.981/1.795
Epoch:     098 | Dis/Gen AvgCost: 1.043/1.522
Minibatch: 001 | Dis/Gen Cost:    1.207/1.046
Minibatch: 201 | Dis/Gen Cost:    0.825/2.073
Minibatch: 401 | Dis/Gen Cost:    0.993/1.592
Minibatch: 601 | Dis/Gen Cost:    0.900/1.328
Minibatch: 801 | Dis/Gen Cost:    1.460/0.950
Epoch:     099 | Dis/Gen AvgCost: 1.031/1.576
Minibatch: 001 | Dis/Gen Cost:    1.285/1.358
Minibatch: 201 | Dis/Gen Cost:    0.938/1.483
Minibatch: 401 | Dis/Gen Cost:    1.046/1.356
Minibatch: 601 | Dis/Gen Cost:    0.920/1.609
Minibatch: 801 | Dis/Gen Cost:    0.862/1.739
Epoch:     100 | Dis/Gen AvgCost: 1.030/1.569
In [5]:
%matplotlib inline
import matplotlib.pyplot as plt

plt.plot(range(len(avg_costs['discriminator'])), 
         avg_costs['discriminator'], label='discriminator')
plt.plot(range(len(avg_costs['generator'])),
         avg_costs['generator'], label='generator')
plt.legend()
plt.show()
In [6]:
####################################
### RELOAD & GENERATE SAMPLE IMAGES
####################################


n_examples = 25

with tf.Session(graph=g) as sess:
    saver.restore(sess, save_path='./gan.ckpt')

    batch_randsample = np.random.uniform(-1, 1, size=(n_examples, gen_input_size))
    new_examples = sess.run('generator/generator_output:0',
                            feed_dict={'generator_input:0': batch_randsample,
                                       'dropout:0': 0.0,
                                       'is_training:0': False})

fig, axes = plt.subplots(nrows=5, ncols=5, figsize=(8, 8),
                         sharey=True, sharex=True)

for image, ax in zip(new_examples, axes.flatten()):
    ax.imshow(image.reshape((dis_input_size // 28, dis_input_size // 28)), cmap='binary')

plt.show()