def _log_prob(self, given):
mean, logstd = self.path_param(self.mean), \
self.path_param(self.logstd)
c = -0.5 * (np.log(2.0) + np.log(np.pi))
precision = tf.exp(-2.0 * logstd)
if self._check_numerics:
precision = tf.check_numerics(precision, "precision")
mask = tf.log(tf.cast(given >= 0., dtype=precision.dtype))
return (c - (logstd + 0.5 * precision * tf.square(given - mean)) + \
tf.nn.softplus(-2.0 * mean * given * precision)) + mask
评论列表
文章目录