title: Error: TensorFlow: tf.enable_eager_execution must be called at program startup
body: <p>I'm trying to modifying code from <a href="https://github.com/aymericdamien/TensorFlow-Examples/blob/master/notebooks/3_NeuralNetworks/neural_network_raw.ipynb" rel="nofollow noreferrer">github</a>:</p>
  
  <p>I'm getting this error:</p>
  
  <pre><code>tf.enable_eager_execution must be called at program startup.
  </code></pre>
  
  <p>and I think its coming from these lines of code:</p>
  
  <pre><code>from __future__ import print_function
  import make_dataset
  
  import tensorflow as tf
  import tensorflow.contrib.eager as tfe
  tf.enable_eager_execution()
  </code></pre>
  
  <p>Additionally the reason why I think I need eager execution is because in my with tf.session block:</p>
  
  <p>with tf.Session() as sess:</p>
  
  <pre><code># Run the initializer
  sess.run(iterator.initializer)
  
  for step in range(1, num_steps+1):
      batch_x, batch_y = myDataset.batch(4)#line where error occurs
      # Run optimization op (backprop)
      sess.run(train_op, feed_dict={X: batch_x, Y: batch_y})
  </code></pre>
  
  <hr>
  
  <p>I get the error:</p>
  
  <p><code>RuntimeError: dataset.__iter__() is only supported when eager execution is enabled</code> </p>
  
  <p>So guidance in deciding to change iterators or enable eager execution would be great.</p>
  
  <p>Much Appreciated,
  Josh</p>