【AttributeError】:
module ‘tensorflow’ has no attribute 'placeholder’
原因:
版本问题,在tf2下使用了tf1的API
解决办法:
将
import tensorflow as tf
替换为
import tensorflow.compat.v1 as tf
tf.disable_v2_behavior()
替换完成后出现了新的AttributeError
【AttributeError】
module ‘tensorflow_core.compat.v1’ has no attribute 'contrib’
解决办法:
不想解决了,装回 tf1