When you are using tensorflow for developing deep learning application, you may find Use `tf.global_variables_initializer` instead warning. In this tutorial, we will introduce how to fix this warning.
As code snippet below:
with tf.Session() as sess: sess.run(tf.initialize_all_variables()) print(sess.run(b)) print(c)
Run this code, you may get this warning.
To fix this warning, you can use tf.global_variables_initializer() to replace it.
Here is an solution.
init = tf.global_variables_initializer() init_local = tf.local_variables_initializer() with tf.Session() as sess: sess.run([init, init_local]) print(sess.run(b)) print(c)
Then run this code again, you will find this warning disappear.