summaryrefslogtreecommitdiff
path: root/neural_style.py
diff options
context:
space:
mode:
authorCameron <cysmith1010@gmail.com>2016-11-16 01:12:31 -0700
committerGitHub <noreply@github.com>2016-11-16 01:12:31 -0700
commitd7474266672176c8994858555bec8c4e40cbb662 (patch)
treef528edd960925afa13c3e1b6978474f81c5b0ce8 /neural_style.py
parent39d4807005f91b46b991051b7272f4a8ccabeee0 (diff)
Update neural_style.py
Diffstat (limited to 'neural_style.py')
-rw-r--r--neural_style.py4
1 files changed, 2 insertions, 2 deletions
diff --git a/neural_style.py b/neural_style.py
index 62875f6..8164b2c 100644
--- a/neural_style.py
+++ b/neural_style.py
@@ -479,9 +479,9 @@ def sum_total_variation_losses(sess, net, input_img):
x = net['input']
tv_y_size = b * (h-1) * w * d
tv_x_size = b * h * (w-1) * d
- loss_y = tf.nn.l2_loss(x[:,1:,:,:] - x[:,:h-1,:,:])
+ loss_y = tf.nn.l2_loss(x[:,1:,:,:] - x[:,:-1,:,:])
loss_y /= tv_y_size
- loss_x = tf.nn.l2_loss(x[:,:,1:,:] - x[:,:,:w-1,:])
+ loss_x = tf.nn.l2_loss(x[:,:,1:,:] - x[:,:,:-1,:])
loss_x /= tv_x_size
loss = 2 * (loss_y + loss_x)
loss = tf.cast(loss, tf.float32)