简体   繁体   中英

WARNING:tensorflow - initialize_all_variables (from tensorflow.python.ops.variables) is deprecated

While initializaing tensorflow

init = tf.initialize_all_variables()
sess = tf.Session()
sess.run(init)

get below warning

WARNING:tensorflow:From D:/Projects/Python/DLPractice/boston_housing.py:75 in <module>.: initialize_all_variables (from tensorflow.python.ops.variables) is deprecated and will be removed after 2017-03-02.
Instructions for updating:
Use `tf.global_variables_initializer` instead.

How to remove the warning and use updated code?

解决方案是使用更新的方法global_variables_initializer()而不是initialize_all_variables

init = tf.global_variables_initializer()

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM