title: Check tensorflow 2 eager execution status
body: <p>I have an old Keras code that I've ported to tensroflow2 <code>tf.keras</code> with minimal changes. It now runs 2x slower on GPU but it is using the GPU. I have used </p>
  
  <pre><code>import tensorflow as tf
  tf.compat.v1.disable_eager_execution()
  </code></pre>
  
  <p>at the top of each of my scripts (I create the model and train it using separate <code>.py</code> files), but I suspect that eager execution might be getting turned on somehow.</p>
  
  <p>I don't use a <code>fit_generator</code> but I do use <code>train_on_batch</code> and do the loop by hand because I'm training an adversarial network.</p>
  
  <p>How can I check/ensure that eager execution has been off throughout? The main script I run is <code>train.py</code> which imports functions from other scripts.</p>