openai/glow

Squeeze implementations differs to that reported in article.

Opened this issue · 1 comments

The article briefly describe the architecture, and refer to Real NVP for more details.

image

This lead me to believe Glow implemented the Squeeze operation as done by Real NVP. It turns out this is not the case, please see the images below.

GLOW:
image

RealNVP:
image

This can be fixed by changing a single line in squeeze2d(..) which can be found in tfops.py.

#x = tf.transpose(x, [0, 1, 3, 5, 2, 4]) # differs to RealNVP
x = tf.transpose(x, [0, 1, 3, 2, 4, 5]) # the same as RealNVP

Please not similar changes needs to be done for unsqueeze2d(..).

Does anyone know if this was intentional? It might be that mixing up channels this way slightly improves performance?

It doesn't matter. Squeeze2d is followed by 1x1 conv layer. After squeezing, both implementations have the same data within each channel group but a different order, they look same for 1x1 conv.