AttributeError: module 'tensorflow' has no attribute 'placeholder'
How to resolve this issue in the current version of TensorFlow
print(tf.__version__) =
2.1.0
1 answers ( 0 marked as helpful)
Hi Jignesh,
Tensorflow 2 introduced the concept of eager execution which makes the tf.placeholder method obsolete.
You're getting this error because your have TF v.2 installed but the code is for TF v.1. You are watching lectures of the "Deep Learning with TensorFlow" course which uses TF 1.
If you wish to follow that course, that's fine, but make sure to have tensorflow 1.* installed in your conda environment. Otherwise, if you wish to write in the newer TF v.2 you should follow the "Deep Learning with TensorFlow 2.0" lectures. Hope that helps and don't hesitate to ask more questions as they arise!
Iskren
You're getting this error because your have TF v.2 installed but the code is for TF v.1. You are watching lectures of the "Deep Learning with TensorFlow" course which uses TF 1.
If you wish to follow that course, that's fine, but make sure to have tensorflow 1.* installed in your conda environment. Otherwise, if you wish to write in the newer TF v.2 you should follow the "Deep Learning with TensorFlow 2.0" lectures. Hope that helps and don't hesitate to ask more questions as they arise!
Iskren