当我们将TensorFlow1.x中的程序迁移到2.0+版本时,在之前1.x版本中有函数tf.placeholder(),替换成tf.compat.v1.placeholder(),运行时报如下错误:

tf.placeholder() is not compatible with eager execution.

 

解决方案:

在代码前加入下面一行即可:

tf.compat.v1.disable_eager_execution()

 

更多请参见博文:

https://blog.csdn.net/caoyuan666/article/details/104706756   

 

 

相关文章:

  • 2022-12-23
  • 2022-01-10
  • 2022-12-23
  • 2022-12-23
  • 2021-07-18
  • 2021-11-25
猜你喜欢
  • 2021-09-03
  • 2022-12-23
  • 2021-10-23
  • 2022-12-23
  • 2021-10-01
  • 2022-01-04
相关资源
相似解决方案