pytorch-normalizing-flows icon indicating copy to clipboard operation
pytorch-normalizing-flows copied to clipboard

Potential bug detected for high-dimension real NVP

Open kfzyqin opened this issue 5 years ago • 1 comments

I found the backflow of real NVP cannot reconstruct the original input data. This is caused by a bug in code when the dimension is more than 2:

https://github.com/karpathy/pytorch-normalizing-flows/blob/b60e119b37be10ce2930ef9fa17e58686aaf2b3d/nflib/flows.py#L108

https://github.com/karpathy/pytorch-normalizing-flows/blob/b60e119b37be10ce2930ef9fa17e58686aaf2b3d/nflib/flows.py#L122

They should be:

x0, x1 = x[:, :self.half_dim], x[:, self.half_dim:] z0, z1 = z[:, :self.half_dim], z[:, self.half_dim:]

kfzyqin avatar Apr 08 '20 06:04 kfzyqin

See #1.

janosh avatar Apr 08 '20 07:04 janosh