openai / glow

Code for reproducing results in "Glow: Generative Flow with Invertible 1x1 Convolutions"
https://arxiv.org/abs/1807.03039
MIT License
3.11k stars 515 forks source link

calculation error when inverting a matrix #82

Open ShuangtongLi opened 5 years ago

ShuangtongLi commented 5 years ago

Hi, I am really interested in your model.I notice that your model requires every layer to be invertible.However,I did a simple test on calculation error when inverting a matrix.It can be viewd as a fully connected network.The result seems unacceptable(all elements in (a-copya) is between 10-100).My simple test code is as below.

import numpy as np sizeb=1000 a=np.random.rand(1,sizeb) copya=a num=5 for i in range(num): exec('weight'+str(i)+'=np.mat(np.random.rand(sizeb,sizeb))') for i in range(num): exec('a=np.dot(a,weight'+str(i)+')') for i in range(num): exec('a=np.dot(a,weight'+str(num-i-1)+'.I)') print(a-copya)

I wonder why your model is able to be invertible,since even a shallow fully connected network get a large calculation error when inverting.I would really appreciate it if you could tell me why it is the case.Thanks a lot!