Skip to content

Commit

Permalink
tf.reduce_mean(tf.stack( -> tf.reduce_mean(
Browse files Browse the repository at this point in the history
  • Loading branch information
dustinvtran committed May 28, 2017
1 parent 1739cd7 commit bed53ce
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions edward/inferences/klqp.py
Expand Up @@ -388,8 +388,8 @@ def build_reparam_loss_and_gradients(inference, var_list):
p_log_prob[s] += tf.reduce_sum(
inference.scale.get(x, 1.0) * x_copy.log_prob(dict_swap[x]))

p_log_prob = tf.reduce_mean(tf.stack(p_log_prob))
q_log_prob = tf.reduce_mean(tf.stack(q_log_prob))
p_log_prob = tf.reduce_mean(p_log_prob)
q_log_prob = tf.reduce_mean(q_log_prob)

if inference.logging:
summary_key = 'summaries_' + str(id(inference))
Expand Down Expand Up @@ -444,7 +444,7 @@ def build_reparam_kl_loss_and_gradients(inference, var_list):
p_log_lik[s] += tf.reduce_sum(
inference.scale.get(x, 1.0) * x_copy.log_prob(dict_swap[x]))

p_log_lik = tf.reduce_mean(tf.stack(p_log_lik))
p_log_lik = tf.reduce_mean(p_log_lik)

kl_penalty = tf.reduce_sum([
inference.kl_scaling.get(z, 1.0) * tf.reduce_sum(ds.kl(qz, z))
Expand Down Expand Up @@ -508,7 +508,7 @@ def build_reparam_entropy_loss_and_gradients(inference, var_list):
p_log_prob[s] += tf.reduce_sum(
inference.scale.get(x, 1.0) * x_copy.log_prob(dict_swap[x]))

p_log_prob = tf.reduce_mean(tf.stack(p_log_prob))
p_log_prob = tf.reduce_mean(p_log_prob)

q_entropy = tf.reduce_sum([
qz.entropy() for z, qz in six.iteritems(inference.latent_vars)])
Expand Down

0 comments on commit bed53ce

Please sign in to comment.