TensorFlow, “‘module’ object has no attribute ‘placeholder'”

If you have this error after an upgrade to TensorFlow 2.0, you can still use 1.X API by replacing:

import tensorflow as tf

by

import tensorflow.compat.v1 as tf
tf.disable_v2_behavior()

Leave a Comment