Skip to content

Commit 8fdc562

Browse files
committed
Minor edit
1 parent 20fa1a6 commit 8fdc562

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

latent_variable_models_part_2.ipynb

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -353,15 +353,15 @@
353353
" x_rc = model.decode(t)\n",
354354
" \n",
355355
" # Expected negative reconstruction error\n",
356-
" rc_error = -tf.reduce_sum(binary_crossentropy(x, x_rc), axis=[1, 2])\n",
356+
" neg_rc_error = -tf.reduce_sum(binary_crossentropy(x, x_rc), axis=[1, 2])\n",
357357
"\n",
358-
" # Regularization term (KL divergence)\n",
359-
" kl_div = 0.5 * tf.reduce_sum(1 + q_log_var \\\n",
360-
" - tf.square(q_mean) \\\n",
361-
" - tf.exp(q_log_var), axis=-1)\n",
358+
" # Regularization term (negative KL divergence)\n",
359+
" neg_kl_div = 0.5 * tf.reduce_sum(1 + q_log_var \\\n",
360+
" - tf.square(q_mean) \\\n",
361+
" - tf.exp(q_log_var), axis=-1)\n",
362362
" \n",
363363
" # Average over mini-batch (of size M)\n",
364-
" return tf.reduce_mean(rc_error + kl_div)"
364+
" return tf.reduce_mean(neg_rc_error + neg_kl_div)"
365365
]
366366
},
367367
{
@@ -622,4 +622,4 @@
622622
},
623623
"nbformat": 4,
624624
"nbformat_minor": 2
625-
}
625+
}

0 commit comments

Comments
 (0)