nn4post_advi_with_elb.py 文件源码

python
阅读 26 收藏 0 点赞 0 评论 0

项目:nn4post 作者: shuiruge 项目源码 文件源码
def gaussian_entropy(sigma):
  """Get the entropy of a multivariate Gaussian distribution with
  ALL DIMENSIONS INDEPENDENT.

  C.f. eq.(8.7) of [here](http://www.biopsychology.org/norwich/isp/\
  chap8.pdf).

  NOTE:
    Gaussian entropy is independent of its center `mu`.

  Args:
    sigma:
      Tensor of shape `[None]`.

  Returns:
    Scalar.
  """
  n_dims = np.prod(sigma.get_shape().as_list())
  return 0.5 * n_dims * tf.log(2. * np.pi * np.e) \
         + tf.reduce_sum(tf.log(sigma))
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号