tensorflow2.0運(yùn)行1.0的代碼會(huì)報(bào)錯(cuò)誤:“AttributeError: module 'tensorflow' has no attribute 'placeholder'”
解決方案:
import tensorflow.compat.v1? ? as? ? ?tf
并在代碼中關(guān)閉eager運(yùn)算:
tf.disable_eager_execution()
tensorflow2.0運(yùn)行1.0的代碼會(huì)報(bào)錯(cuò)誤:“AttributeError: module 'tensorflow' has no attribute 'placeholder'”
解決方案:
import tensorflow.compat.v1? ? as? ? ?tf
并在代碼中關(guān)閉eager運(yùn)算:
tf.disable_eager_execution()