Skip to content

Instantly share code, notes, and snippets.

@ArnoutDevos
Created January 8, 2018 11:39
Show Gist options
  • Save ArnoutDevos/6bcc3e5f5baff5703aee969150c7acfc to your computer and use it in GitHub Desktop.
Save ArnoutDevos/6bcc3e5f5baff5703aee969150c7acfc to your computer and use it in GitHub Desktop.
CONTENT_LAYER = 'conv4_2'
def content_loss_func(sess, model):
def _content_loss(current_feat, content_feat):
loss = 0.5*tf.reduce_sum(tf.square(current_feat - content_feat))
return loss
return _content_loss(sess.run(model[CONTENT_LAYER]), model[CONTENT_LAYER])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment