def _log_prob(self, given):
given = tf.cast(given, self.param_dtype)
given, logits = maybe_explicit_broadcast(
given, self.logits, 'given', 'logits')
normalized_logits = logits - tf.reduce_logsumexp(
logits, axis=-1, keep_dims=True)
n = tf.cast(self.n_experiments, self.param_dtype)
log_p = log_combination(n, given) + \
tf.reduce_sum(given * normalized_logits, -1)
return log_p
评论列表
文章目录