def build_model(self):
self.inputs = tf.placeholder(tf.float32, [self.batch_size, self.input_size, self.input_size, 3], name='real_images')
# self.inputs = tf.placeholder(tf.float32, [None, self.input_size, self.input_size, 3], name='real_images')
try:
self.up_inputs = tf.image.resize_images(self.inputs, self.image_shape[0], self.image_shape[1], tf.image.ResizeMethod.NEAREST_NEIGHBOR)
except ValueError:
# newer versions of tensorflow
self.up_inputs = tf.image.resize_images(self.inputs, [self.image_shape[0], self.image_shape[1]], tf.image.ResizeMethod.NEAREST_NEIGHBOR)
self.images = tf.placeholder(tf.float32, [self.batch_size] + self.image_shape, name='real_images')
# self.images = tf.placeholder(tf.float32, [None] + self.image_shape, name='real_images')
self.sample_images= tf.placeholder(tf.float32, [self.sample_size] + self.image_shape, name='sample_images')
# self.sample_images = tf.placeholder(tf.float32, [None] + self.image_shape, name='sample_images')
self.G = self.generator(self.inputs)
self.G_sum = tf.image_summary("G", self.G)
self.g_loss = tf.reduce_mean(tf.square(self.images-self.G))
self.g_loss_sum = tf.scalar_summary("g_loss", self.g_loss)
t_vars = tf.trainable_variables()
self.g_vars = [var for var in t_vars if 'g_' in var.name]
self.saver = tf.train.Saver()
评论列表
文章目录