black formatted files before changes

This commit is contained in:
Jan Kowalczyk
2024-06-28 11:36:46 +02:00
parent d33c6b1e16
commit 71f9662022
40 changed files with 2938 additions and 1260 deletions

View File

@@ -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)