def batch_log_pdf(self, x):
"""
Ref: :py:meth:`pyro.distributions.distribution.Distribution.batch_log_pdf`
"""
# expand to patch size of input
mu = self.mu.expand(self.shape(x))
gamma = self.gamma.expand(self.shape(x))
x_0 = torch.pow((x - mu) / gamma, 2)
px = np.pi * gamma * (1 + x_0)
log_pdf = -1 * torch.sum(torch.log(px), -1)
batch_log_pdf_shape = self.batch_shape(x) + (1,)
return log_pdf.contiguous().view(batch_log_pdf_shape)
评论列表
文章目录