Skip to content

Commit

Permalink
Fix log jacobian computation
Browse files Browse the repository at this point in the history
  • Loading branch information
LarsKue committed Sep 26, 2023
1 parent ec8dab6 commit db34910
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions FrEIA/modules/invertible_resnet.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,10 +77,10 @@ def forward(self, x, c=None, rev=False, jac=True):

if not rev:
out = (x - self.loc) / self.scale
log_jac_det = -utils.sum_except_batch(self.log_scale)
log_jac_det = -utils.sum_except_batch(self.log_scale) * torch.prod(torch.tensor(x.shape[2:]).float())
else:
out = self.scale * x + self.loc
log_jac_det = utils.sum_except_batch(self.log_scale)
log_jac_det = utils.sum_except_batch(self.log_scale) * torch.prod(torch.tensor(x.shape[2:]).float())

return (out,), log_jac_det

Expand Down

0 comments on commit db34910

Please sign in to comment.