Skip to content

Commit

Permalink
Merge pull request #52 from Lupino/master
Browse files Browse the repository at this point in the history
update to support tensorflow 1.0.0
  • Loading branch information
lengstrom committed Feb 23, 2017
2 parents e218db9 + 54bb73e commit 1424228
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions src/optimize.py
Expand Up @@ -72,7 +72,7 @@ def optimize(content_targets, style_target, content_weight, style_weight,
size = height * width * filters
feats = tf.reshape(layer, (bs, height * width, filters))
feats_T = tf.transpose(feats, perm=[0,2,1])
grams = tf.batch_matmul(feats_T, feats) / size
grams = tf.matmul(feats_T, feats) / size
style_gram = style_features[style_layer]
style_losses.append(2 * tf.nn.l2_loss(grams - style_gram)/style_gram.size)

Expand All @@ -89,7 +89,7 @@ def optimize(content_targets, style_target, content_weight, style_weight,

# overall loss
train_step = tf.train.AdamOptimizer(learning_rate).minimize(loss)
sess.run(tf.initialize_all_variables())
sess.run(tf.global_variables_initializer())
import random
uid = random.randint(1, 100)
print("UID: %s" % uid)
Expand Down
2 changes: 1 addition & 1 deletion src/transform.py
Expand Up @@ -35,7 +35,7 @@ def _conv_tranpose_layer(net, num_filters, filter_size, strides):
# new_shape = #tf.pack([tf.shape(net)[0], new_rows, new_cols, num_filters])

new_shape = [batch_size, new_rows, new_cols, num_filters]
tf_shape = tf.pack(new_shape)
tf_shape = tf.stack(new_shape)
strides_shape = [1,strides,strides,1]

net = tf.nn.conv2d_transpose(net, weights_init, tf_shape, strides_shape, padding='SAME')
Expand Down

0 comments on commit 1424228

Please sign in to comment.