Skip to content

Instantly share code, notes, and snippets.

@FelixMohr

FelixMohr/vae.py Secret

Created October 20, 2017 12:14
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save FelixMohr/a83e57393647dd2971d5ae12bb01f504 to your computer and use it in GitHub Desktop.
Save FelixMohr/a83e57393647dd2971d5ae12bb01f504 to your computer and use it in GitHub Desktop.
unreshaped = tf.reshape(dec, [-1, 28*28])
img_loss = tf.reduce_sum(tf.squared_difference(unreshaped, Y_flat), 1)
latent_loss = -0.5 * tf.reduce_sum(1.0 + 2.0 * sd - tf.square(mn) - tf.exp(2.0 * sd), 1)
loss = tf.reduce_mean(img_loss + latent_loss)
optimizer = tf.train.AdamOptimizer(0.0005).minimize(loss)
sess = tf.Session()
sess.run(tf.global_variables_initializer())
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment