码迷,mamicode.com
首页 > 其他好文 > 详细

在tensorflow程序运行的时候一定要记住初始化

时间:2019-12-30 12:59:20      阅读:186      评论:0      收藏:0      [点我收藏+]

标签:elf   tensor   led   package   错误   flow   list   packages   fetch   

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程序运行的时候一定要记住初始化

标签:elf   tensor   led   package   错误   flow   list   packages   fetch   

原文地址:https://www.cnblogs.com/laowangxieboke/p/12119169.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!