This error may come if you have installed TensorFlow 2.0 and want to run code that is not compatible with TensorFlow 2.0
For example if you are trying to run below code, you will get the above error.
x = tf.placeholder("float", None)
The sample error is shown in the Image below
To fix this we need to use the below code
import tensorflow.compat.v1 as tf tf.disable_v2_behavior()
Then if you run the same code it will not give you error as below
You may like to read our other popular posts as below:
- Linear Regression in Python in 10 Lines
- Logistic Regression In Python in 10 Lines
- Generating Synthetic Data for Logistic Regression
- Scatter Plot using Seaborn and Sklearn
I hope you enjoyed this article and can start using some of the techniques described here in your own projects soon.