vendredi 27 juillet 2018

Why all variables are zeros after initialization. (using random_normal() )

My friend has random values with same code, i think that is tensorflow's problem.

here is my code:

import tensorflow as tf

w1 = tf.random_normal([2,3], stddev=1, seed=1)
w2 = tf.random_normal([3,1], stddev=1, seed=1)

sess = tf.Session()

init=tf.global_variables_initializer()
sess.run(init)

print(sess.run(w1))
print(sess.run(w2))

sess.close()

output:

[[ 0.  0.  0.]
 [ 0.  0.  0.]]
[[ 0.]
 [ 0.]
 [ 0.]]

I using anaconda3 ,python3.6.5 ,tensorflow is gpu ver. someone can told me how to fix it? thank u




Aucun commentaire:

Enregistrer un commentaire