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