class_docstr: Feedable data iterator that alternatives between train, val, and test
  datasets.
  
  This is a wrapper of :class:`~texar.tf.data.FeedableDataIterator`.
  The iterator can switch to a dataset and resume from where it was
  left off when it was visited last time.
  
  :attr:`train`, :attr:`val`, and :attr:`test` can be instance of
  either :tf_main:`tf.data.Dataset <data/Dataset>` or subclass of
  :class:`~texar.tf.data.DataBase`. At least one of them must be provided.
  
  Args:
      train (optional): Training data.
      val (optional): Validation data.
      test (optional): Test data.
  
  Example:
  
      .. code-block:: python
  
          train_data = MonoTextData(hparams={'num_epochs': 200, ...})
          test_data = MonoTextData(hparams_test)
          iterator = TrainTestFeedableDataIterator(train=train_data,
                                                   test=test_data)
          batch = iterator.get_next()
  
          sess = tf.Session()
  
          def _eval_epoch(): # Iterate through test data for one epoch
              # Initialize and start from beginning of test data
              iterator.initialize_test_dataset(sess)
              while True:
                  try:
                      fetch_dict = { # Read from test data
                          iterator.handle: Iterator.get_test_handle(sess)
                      }
                      test_batch_ = sess.run(batch, feed_dict=feed_dict)
                  except tf.errors.OutOfRangeError:
                      print("End of test epoch.")
  
          # Initialize and start from beginning of training data
          iterator.initialize_train_dataset(sess)
          step = 0
          while True:
              try:
                  fetch_dict = { # Read from training data
                      iterator.handle: Iterator.get_train_handle(sess)
                  }
                  train_batch_ = sess.run(batch, fetch_dict=fetch_dict)
  
                  step +=1
                  if step % 200 == 0: # Evaluate periodically
                      _eval_epoch()
              except tf.errors.OutOfRangeError:
                  print("End of training.")
class_docstr_tok: ["Feedable","data","iterator","that","alternatives","between","train",",","val",",","and","test","datasets",".","This","is","a","wrapper","of",":","class",":","`","~texar.tf.data.FeedableDataIterator","`",".","The","iterator","can","switch","to","a","dataset","and","resume","from","where","it","was","left","off","when","it","was","visited","last","time",".",":","attr",":","`","train","`",",",":","attr",":","`","val","`",",","and",":","attr",":","`","test","`","can","be","instance","of","either",":","tf_main",":","`","tf.data.Dataset","<","data\/Dataset",">","`","or","subclass","of",":","class",":","`","~texar.tf.data.DataBase","`",".","At","least","one","of","them","must","be","provided",".","Args",":","train","(","optional",")",":","Training","data",".","val","(","optional",")",":","Validation","data",".","test","(","optional",")",":","Test","data",".","Example",":","..","code-block",":",":","python","train_data","=","MonoTextData","(","hparams=","{","'num_epochs","'",":","200",",","...","}",")","test_data","=","MonoTextData","(","hparams_test",")","iterator","=","TrainTestFeedableDataIterator","(","train=train_data",",","test=test_data",")","batch","=","iterator.get_next","(",")","sess","=","tf.Session","(",")","def","_eval_epoch","(",")",":","#","Iterate","through","test","data","for","one","epoch","#","Initialize","and","start","from","beginning","of","test","data","iterator.initialize_test_dataset","(","sess",")","while","True",":","try",":","fetch_dict","=","{","#","Read","from","test","data","iterator.handle",":","Iterator.get_test_handle","(","sess",")","}","test_batch_","=","sess.run","(","batch",",","feed_dict=feed_dict",")","except","tf.errors.OutOfRangeError",":","print","(","``","End","of","test","epoch",".","''",")","#","Initialize","and","start","from","beginning","of","training","data","iterator.initialize_train_dataset","(","sess",")","step","=","0","while","True",":","try",":","fetch_dict","=","{","#","Read","from","training","data","iterator.handle",":","Iterator.get_train_handle","(","sess",")","}","train_batch_","=","sess.run","(","batch",",","fetch_dict=fetch_dict",")","step","+=1","if","step","%","200","==","0",":","#","Evaluate","periodically","_eval_epoch","(",")","except","tf.errors.OutOfRangeError",":","print","(","``","End","of","training",".","''",")"]
docstr: Restarts the validation dataset so that next iteration will fetch
  data from the beginning of the validation dataset.
  
  Args:
      sess: The current tf session.
docstr_tok: ["Restarts","the","validation","dataset","so","that","next","iteration","will","fetch","data","from","the","beginning","of","the","validation","dataset",".","Args",":","sess",":","The","current","tf","session","."]
code: def restart_val_dataset(self, sess):
      """Restarts the validation dataset so that next iteration will fetch
      data from the beginning of the validation dataset.
  
      Args:
          sess: The current tf session.
      """
      if self._val_name not in self._datasets:
          raise ValueError("Val data not provided.")
      self.restart_dataset(sess, self._val_name)
  
imports: import tensorflow
  from texar.tf.data.data.data_base import DataBase
  from texar.tf.utils.variables import get_unique_named_variable_scope
label_desc: Use image node_id 6 for calling the TrainTestFeedableDataIterator obj's underlying member method code with example usage: obj.restart_val_dataset(sess) without return types