February 2018
Intermediate to advanced
450 pages
11h 27m
English
Finally, before training our model, we need to implement the optimization criteria for this task. We will use the naming conventions that we used previously to retrieve the trainable parameters for the discriminator and the generator and train them:
# specifying the optimization criteriadef model_optimizer(disc_loss, gen_loss, learning_rate, beta1): trainable_vars = tf.trainable_variables() disc_vars = [var for var in trainable_vars if var.name.startswith('discriminator')] gen_vars = [var for var in trainable_vars if var.name.startswith('generator')] disc_train_opt = tf.train.AdamOptimizer( learning_rate, beta1=beta1).minimize(disc_loss, var_list=disc_vars) update_operations = tf.get_collection(tf.GraphKeys.UPDATE_OPS) gen_updates ...
Read now
Unlock full access