From ebeb264ee31532dbe26fdd0f3be253ce785c67e9 Mon Sep 17 00:00:00 2001 From: datbui Date: Sun, 1 Oct 2017 22:26:46 -0500 Subject: [PATCH] Migrate to tensorflow 1.3.0 - change parameters order; - use new methods instead of deprecated. --- model.py | 8 ++++---- ops.py | 2 +- subpixel.py | 12 ++++++------ 3 files changed, 11 insertions(+), 11 deletions(-) diff --git a/model.py b/model.py index 0153090..b9cb403 100755 --- a/model.py +++ b/model.py @@ -74,11 +74,11 @@ def build_model(self): self.G = self.generator(self.inputs) - self.G_sum = tf.image_summary("G", self.G) + self.G_sum = tf.summary.image("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) + self.g_loss_sum = tf.summary.scalar("g_loss", self.g_loss) t_vars = tf.trainable_variables() @@ -96,8 +96,8 @@ def train(self, config): tf.initialize_all_variables().run() self.saver = tf.train.Saver() - self.g_sum = tf.merge_summary([self.G_sum, self.g_loss_sum]) - self.writer = tf.train.SummaryWriter("./logs", self.sess.graph) + self.g_sum = tf.summary.merge([self.G_sum, self.g_loss_sum]) + self.writer = tf.summary.FileWriter("./logs", self.sess.graph) sample_files = data[0:self.sample_size] sample = [get_image(sample_file, self.image_size, is_crop=self.is_crop) for sample_file in sample_files] diff --git a/ops.py b/ops.py index 8975f58..fc5633e 100644 --- a/ops.py +++ b/ops.py @@ -62,7 +62,7 @@ def conv_cond_concat(x, y): """Concatenate conditioning vector on feature map axis.""" x_shapes = x.get_shape() y_shapes = y.get_shape() - return tf.concat(3, [x, y*tf.ones([x_shapes[0], x_shapes[1], x_shapes[2], y_shapes[3]])]) + return tf.concat([x, y*tf.ones([x_shapes[0], x_shapes[1], x_shapes[2], y_shapes[3]])], 3) def conv2d(input_, output_dim, k_h=5, k_w=5, d_h=2, d_w=2, stddev=0.02, diff --git a/subpixel.py b/subpixel.py index 3b9a1cf..bd12057 100644 --- a/subpixel.py +++ b/subpixel.py @@ -8,17 +8,17 @@ def _phase_shift(I, r): bsize = tf.shape(I)[0] # Handling Dimension(None) type for undefined batch dim X = tf.reshape(I, (bsize, a, b, r, r)) X = tf.transpose(X, (0, 1, 2, 4, 3)) # bsize, a, b, 1, 1 - X = tf.split(1, a, X) # a, [bsize, b, r, r] - X = tf.concat(2, [tf.squeeze(x, axis=1) for x in X]) # bsize, b, a*r, r - X = tf.split(1, b, X) # b, [bsize, a*r, r] - X = tf.concat(2, [tf.squeeze(x, axis=1) for x in X]) # bsize, a*r, b*r + X = tf.split(X, a, 1) # a, [bsize, b, r, r] + X = tf.concat([tf.squeeze(x, axis=1) for x in X], 2) # bsize, b, a*r, r + X = tf.split(X, b, 1) # b, [bsize, a*r, r] + X = tf.concat([tf.squeeze(x, axis=1) for x in X], 2) # bsize, a*r, b*r return tf.reshape(X, (bsize, a*r, b*r, 1)) def PS(X, r, color=False): if color: - Xc = tf.split(3, 3, X) - X = tf.concat(3, [_phase_shift(x, r) for x in Xc]) + Xc = tf.split(X, 3, 3) + X = tf.concat([_phase_shift(x, r) for x in Xc], 3) else: X = _phase_shift(X, r) return X