在tensorflow程序运行的时候一定要记住初始化
Posted laowangxieboke
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了在tensorflow程序运行的时候一定要记住初始化相关的知识,希望对你有一定的参考价值。
init=tf.global_variables_initializer()
with tf.Session() as sess
sess.run(init)
如果欠缺这一步会出现错误:
FailedPreconditionError Traceback (most recent call last)
~/anaconda3/lib/python3.6/site-packages/tensorflow/python/client/session.py in _do_call(self, fn, *args)
1355 try:
-> 1356 return fn(*args)
1357 except errors.OpError as e:
~/anaconda3/lib/python3.6/site-packages/tensorflow/python/client/session.py in _run_fn(feed_dict, fetch_list, target_list, options, run_metadata)
1340 return self._call_tf_sessionrun(
-> 1341 options, feed_dict, fetch_list, target_list, run_metadata)
1342
~/anaconda3/lib/python3.6/site-packages/tensorflow/python/client/session.py in _call_tf_sessionrun(self, options, feed_dict, fetch_list, target_list, run_metadata)
1428 self._session, options, feed_dict, fetch_list, target_list,
-> 1429 run_metadata)
1430
以上是关于在tensorflow程序运行的时候一定要记住初始化的主要内容,如果未能解决你的问题,请参考以下文章