Assume you are using Tensorflow 2.0 preview release which has eager execution enabled by default. There is a disable_eager_execution()
in v1 API, which you can put in the front of your code like:
import tensorflow as tf
tf.compat.v1.disable_eager_execution()
On the other hand, if you are not using 2.0 preview, please check if you accidentally enabled eager execution somewhere.