解决module 'tensorflow' has no attribute 'placeholder'
原代码
import tensorflow as tf
xxx
tf.placeholder(tf.float32,shape=(batch_size,4,4,16))
运行报错
module 'tensorflow' has no attribute 'placeholder'
原因分析
tensorflow2调用了tensorflow1的API
解决方案
import tensorflow.compat.v1 as tf
tf.compat.v1.disable_eager_execution()