def gaussian_log_density(x, mu, sigma2):
c = - 0.5 * math.log(2 * math.pi)
density = c - tf.log(sigma2) / 2 - tf.squared_difference(x, mu) / (2 * sigma2)
return -tf.reduce_mean(tf.reduce_sum(density, axis=-1), axis=(1, 2))
评论列表
文章目录