chaiyujin / glow-pytorch

pytorch implementation of openai paper "Glow: Generative Flow with Invertible 1×1 Convolutions"
MIT License
507 stars 80 forks source link

Recommendations for computations stability #7

Closed arogozhnikov closed 5 years ago

arogozhnikov commented 5 years ago

I've performed some tests for reversible modules, I think the following recommendations should be helpful:

Thanks for porting code to torch :)

chaiyujin commented 5 years ago

Thanks so much for you recommendations. I'll follow them and fix the code.

wmjung commented 5 years ago

The slogdet function returns a tuple of sign and absolute value of determinant. https://pytorch.org/docs/stable/torch.html#torch.slogdet I think you need to modify to get the value like below

torch.slogdet(self.weight)[1] * pixels

chaiyujin commented 5 years ago

oooh, my fault. It should be torch.logdet().

arogozhnikov commented 5 years ago

oooh, my fault. It should be torch.logdet().

@wmjung is right - you just need to take second value in output, because in paper you compute log-abs-det, that's exactly the second value of slogdet!

chaiyujin commented 5 years ago

Yes, you're right. I tried and fixed it.