In this section, we are going to build the entire network using the generator and the discriminator functions and also define the cost function to be optimized during the training process. The TensorFlow code is as follows:
def build_network(self):
def squared_loss(y_pred,labels):
return tf.reduce_mean((y_pred - labels)**2)
def abs_loss(y_pred,labels):
return tf.reduce_mean(tf.abs(y_pred - labels))
def binary_cross_entropy_loss(logits,labels):
return tf.reduce_mean(tf.nn.sigmoid_cross_entropy_with_logits(
labels=labels,logits=logits))
self.images_real = tf.placeholder(tf.float32,[None,self.image_size,self.image_size,self.input_dim + self.output_dim])
self.image_real_A = self.images_real[:,:,:,:self.input_dim]
self.image_real_B =
self.images_real...