black formatted files before changes
This commit is contained in:
@@ -11,7 +11,7 @@ def log_standard_gaussian(x):
|
||||
:param x: point to evaluate
|
||||
:return: log N(x|0,I)
|
||||
"""
|
||||
return torch.sum(-0.5 * math.log(2 * math.pi) - x ** 2 / 2, dim=-1)
|
||||
return torch.sum(-0.5 * math.log(2 * math.pi) - x**2 / 2, dim=-1)
|
||||
|
||||
|
||||
def log_gaussian(x, mu, log_var):
|
||||
@@ -23,7 +23,11 @@ def log_gaussian(x, mu, log_var):
|
||||
:param log_var: log variance
|
||||
:return: log N(x|µ,σI)
|
||||
"""
|
||||
log_pdf = -0.5 * math.log(2 * math.pi) - log_var / 2 - (x - mu)**2 / (2 * torch.exp(log_var))
|
||||
log_pdf = (
|
||||
-0.5 * math.log(2 * math.pi)
|
||||
- log_var / 2
|
||||
- (x - mu) ** 2 / (2 * torch.exp(log_var))
|
||||
)
|
||||
return torch.sum(log_pdf, dim=-1)
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user