(self, input, output)
| 117 | return l |
| 118 | |
| 119 | def build_graph(self, input, output): |
| 120 | input, output = input / 128.0 - 1, output / 128.0 - 1 |
| 121 | |
| 122 | with argscope([Conv2D, Conv2DTranspose], kernel_initializer=tf.truncated_normal_initializer(stddev=0.02)): |
| 123 | with tf.variable_scope('gen'): |
| 124 | fake_output = self.generator(input) |
| 125 | with tf.variable_scope('discrim'): |
| 126 | real_pred = self.discriminator(input, output) |
| 127 | fake_pred = self.discriminator(input, fake_output) |
| 128 | |
| 129 | self.build_losses(real_pred, fake_pred) |
| 130 | errL1 = tf.reduce_mean(tf.abs(fake_output - output), name='L1_loss') |
| 131 | self.g_loss = tf.add(self.g_loss, LAMBDA * errL1, name='total_g_loss') |
| 132 | add_moving_summary(errL1, self.g_loss) |
| 133 | |
| 134 | # tensorboard visualization |
| 135 | if IN_CH == 1: |
| 136 | input = tf.image.grayscale_to_rgb(input) |
| 137 | if OUT_CH == 1: |
| 138 | output = tf.image.grayscale_to_rgb(output) |
| 139 | fake_output = tf.image.grayscale_to_rgb(fake_output) |
| 140 | |
| 141 | visualize_tensors('input,output,fake', [input, output, fake_output], max_outputs=max(30, BATCH)) |
| 142 | |
| 143 | self.collect_variables() |
| 144 | |
| 145 | def optimizer(self): |
| 146 | lr = tf.get_variable('learning_rate', initializer=2e-4, trainable=False) |
nothing calls this directly
no test coverage detected