zoukankan      html  css  js  c++  java
  • RuntimeError: The Session graph is empty. Add operations to the graph before calling run().解决方法

    问题产生的原因:无法执行sess.run()的原因是tensorflow版本不同导致的,tensorflow版本2.0无法兼容版本1.0.
    解决办法:
    tf.compat.v1.disable_eager_execution()

    import tensorflow as tf
    tf.compat.v1.disable_eager_execution() #保证sess.run()能够正常运行
    hello = tf.constant('hello,tensorflow')
    sess= tf.compat.v1.Session()#版本2.0的函数
    print(sess.run(hello))

    后记:(1)对问题的认知,能够帮助自己快速定位问题。
          开始定位问题时,太懒,直接连英文的意思都没搞懂,就直接粘贴到百度去搜索,于是根本无法找到合适的答案。
       (2)明确问题,这个问题是图是空的,然后我去查看图建立的方法,没错,就是这样建立的。然后怀疑可能时无法执行sess.run()。
       (3)遇到问题,一定要深入思考一下,才是问题的根因,直接依据问题的表面去查找答案,根本无法找到。
    参考链接:https://blog.csdn.net/sinat_36502563/article/details/102302392
    参考链接:https://ask.csdn.net/questions/657580
    ————————————————
    原文链接:https://blog.csdn.net/weixin_38410551/article/details/103631977

  • 相关阅读:
    RadioGroup,Radio单选按钮,CheckBox的使用
    使用Intent启动图片裁剪时遇到的问题:Intent#setData()与Intent#setType()赋值问题
    onActivityResult()的用法
    android:图片裁剪
    Sublime Text快捷键
    sublime text3 安装插件
    windows的git服务器搭建
    查询字符串是否已存在
    js 兼容基础
    SOA 一些基本概念
  • 原文地址:https://www.cnblogs.com/swxj/p/14695880.html
Copyright © 2011-2022 走看看