bayesiains / nflows

Normalizing flows in PyTorch
MIT License
845 stars 118 forks source link

Checkerboard masking in RealNVP #47

Open Donglin-Wang2 opened 3 years ago

Donglin-Wang2 commented 3 years ago

Hi,

Since the CouplingTransform class in nflows.transforms.coupling module only supports a 1-d mask that splits data along the channel dimension, I am wondering how I would go about implementing the alternating checkerboard mask in the RealNVP paper? Should I used the MaskedAffineAutoregressiveTransform in the nflows.transforms.autoregressive instead? Or are there some other methods or classes that I am not aware of?

Also, thank you so much for providing such a clean implementation of flow models in PyTorch!

Sincerely, Donglin Wang

arturbekasov commented 2 years ago

Hey Donglin. Nope, unfortunately the checkerboard masking isn't implemented. I'll keep this issue around in case you (or someone else) want to implement it. Cheers, Artur

arturbekasov commented 2 years ago

We do have a RealNVP implementation with 1D checkerboard masking, though: https://github.com/bayesiains/nflows/blob/master/nflows/flows/realnvp.py#L17