AttributeError: module 'tensorflow' has no attribute 'placeholder' site:stackoverflow.com code example

Example 1: AttributeError: module 'tensorflow' has no attribute 'placeholder' site:stackoverflow.com

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

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

#replace import tensorflow as tf by following
import tensorflow.compat.v1 as tf
tf.disable_v2_behavior()

Example 3: AttributeError: module 'tensorflow' has no attribute 'placeholder' site:stackoverflow.com

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

Tags:

Misc Example