ikostrikov/pytorch-flows

Need minus sign in reverse log density computation

jaanli opened this issue · 0 comments

return u, -a.sum(-1, keepdim=True)

This currently matches

return x, -a.sum(-1, keepdim=True)
- but L114 should have no minus sign for the log determinant of the Jacobian.

The forward computation is on

u = (inputs - m) * torch.exp(-a)

u = (inputs - m) * torch.exp(-a)

The inverse of this is

inputs = u * torch.exp(a) + m

So the log determinant jacobian of the inverse is a.sum(-1, keepdim=True) not -a.sum(-1, keepdim=True).

Might be missing something here!