title: Tensorflow crash course question about iterate over data set
body: <p>I am very confused by the my_input_fn() at
  <a href="https://colab.research.google.com/notebooks/mlcc/first_steps_with_tensor_flow.ipynb" rel="nofollow noreferrer">https://colab.research.google.com/notebooks/mlcc/first_steps_with_tensor_flow.ipynb</a></p>
  
  <p>If shuffle = False, won't estimator.train() use the same subset of data within the loop? i.e., loop iteration #1 and #0 use the same subset of data.</p>
  
  <p>The goal here is:
  * call estimator.train() in a loop
  * evaluate validation error within the loop
  * train() and evaluate should be done on different subset of the data for different loop iteration#.</p>
  
  <p>From runtime debug msg, it looks that input_func is called each time train() is called, e.g., if loop count is 10, input_func() will be called 10 times.  Since input_func sets up the dataset each time (re-initialize the tf.data.Dataset), the evaluate is done on the same subset of dataset for each of the 10 times.  The train() is done on the whole set because shuffle = True. If shuffle is False, train will be done on the same subset of dataset for each of the 10 times also.</p>
  
  <p>I understand within each train(), it will iterate through the tf.data.Dataset.  But if train() is called again, it will iterate through the same subset of tf.data.Dataset just like the previous time (suppose that shuffle is False).</p>
  
  <p>I looked at the doc. It looks like that to feed different invocations of estimator.train() with different data, one has to create a new dataset for each estimator.train(). e.g., using data row 1-10000 to create tf.data.Dataset for 1st call of estimator.train(), then using data row 10001-20000 to create tf.data.Dataset for 2nd call of estimator.train().</p>
  
  <p>Is there a better way to feed tf.data.Dataset to different invocations of estimator.train() within a loop?</p>
  
  <p>Thanks.</p>