當我們將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