Model training

Finally, let's go ahead and kick off the training process after putting it all together:

class GAN:        def __init__(self, real_size, z_size, learning_rate, num_classes=10, alpha=0.2, beta1=0.5):            tf.reset_default_graph()            self.learning_rate = tf.Variable(learning_rate, trainable=False)            model_inputs = inputs(real_size, z_size)            self.input_actual, self.input_latent_z, self.target, self.label_mask = model_inputs            self.drop_out_rate = tf.placeholder_with_default(.5, (), "drop_out_rate")            losses_results = model_losses(self.input_actual, self.input_latent_z,                                          real_size[2], self.target, num_classes,                                          label_mask=self.label_mask,                                          leaky_alpha=0.2,                                          drop_out_rate=self.drop_out_rate)            self.disc_loss, self.gen_loss, self.correct, self.masked_correct ...

Get Deep Learning By Example now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.