tensorflow :AttributeError: module 'tensorflow' has no attribute 'placeholder'

图片说明

I tensorflow/stream_executor/platform/default/dso_loader.cc:44]
Successfully opened dynamic library cudart64_100.dll

Traceback (most recent call last):
File "G:/pycharm/mycode-ZZQ/TensorflowDemo/demo1.py", line 7, in
a_ph = tf.placeholder(tf.float32, name='variable_a')
AttributeError: module 'tensorflow' has no attribute 'placeholder'

大佬有知道怎么回事嘛,我卸载又安装还是不管用

tf.compat.v1.disable_eager_execution()
xl = tf.compat.v1.placeholder(tf.float32, [batch_size, None, None, 1], name='xl')

尝试前面加compat.v1