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

about actnorm #53

Open yjmlaile opened 6 years ago

yjmlaile commented 6 years ago

The data after actnorm and reverse actnorm is very different from the original data,

my code begin

a = tf.constant(np.random.randn(3,4,4,3), dtype = tf.float32, name = "a") net = a

with tf.variable_scope("scope") as scope: for i in range(30): net = actnorm("act"+str(i), net)

with tf.variable_scope("scope") as scope: scope.reuse_variables() for j in reversed(range(30)): net = actnorm("act"+str(j), net, reverse = True)

with tf.Session() as sess: init = tf.global_variables_initializer() sess.run(init) _a, _net = sess.run([a, net])

print("_a - _net is", _a - _net)

end

output begin

"_a - _net is"...... [[ 1.5863475e+05 -8.5023642e-02 1.2175249e+04] [ 1.5863484e+05 4.7517967e-01 1.2174989e+04] [ 1.5863616e+05 5.8058143e-02 1.2174503e+04] [ 1.5863489e+05 -5.7814121e-02 1.2174427e+04]]

[[ 1.5863278e+05 1.6660476e-01 1.2175197e+04] [ 1.5863495e+05 4.9495590e-01 1.2174029e+04] [ 1.5863642e+05 -2.7934742e-01 1.2174598e+04] [ 1.5863430e+05 4.6225822e-01 1.2173828e+04]]

[[ 1.5863350e+05 9.5161140e-02 1.2175784e+04] [ 1.5863411e+05 9.7796828e-02 1.2175356e+04] [ 1.5863566e+05 1.8912268e-01 1.2171764e+04] [ 1.5863397e+05 1.6332370e-01 1.2173685e+04]]]] ......

output end

I want to know how to solve this problem,if this reverse operation can't reverse completely? thanks