class_docstr: Data iterator that alternatives between train, val, and test datasets.
  
  :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.
  
  This is a wrapper of :class:`~texar.tf.data.DataIterator`.
  
  Args:
      train (optional): Training data.
      val (optional): Validation data.
      test (optional): Test data.
  
  Example:
  
      .. code-block:: python
  
          train_data = MonoTextData(hparams_train)
          val_data = MonoTextData(hparams_val)
          iterator = TrainTestDataIterator(train=train_data, val=val_data)
          batch = iterator.get_next()
  
          sess = tf.Session()
  
          for _ in range(200): # Run 200 epochs of train/val
              # Starts iterating through training data from the beginning
              iterator.switch_to_train_data(sess)
              while True:
                  try:
                      train_batch_ = sess.run(batch)
                  except tf.errors.OutOfRangeError:
                      print("End of training epoch.")
              # Starts iterating through val data from the beginning
              iterator.switch_to_val_dataset(sess)
              while True:
                  try:
                      val_batch_ = sess.run(batch)
                  except tf.errors.OutOfRangeError:
                      print("End of val epoch.")
class_docstr_tok: ["Data","iterator","that","alternatives","between","train",",","val",",","and","test","datasets",".",":","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",".","This","is","a","wrapper","of",":","class",":","`","~texar.tf.data.DataIterator","`",".","Args",":","train","(","optional",")",":","Training","data",".","val","(","optional",")",":","Validation","data",".","test","(","optional",")",":","Test","data",".","Example",":","..","code-block",":",":","python","train_data","=","MonoTextData","(","hparams_train",")","val_data","=","MonoTextData","(","hparams_val",")","iterator","=","TrainTestDataIterator","(","train=train_data",",","val=val_data",")","batch","=","iterator.get_next","(",")","sess","=","tf.Session","(",")","for","_","in","range","(","200",")",":","#","Run","200","epochs","of","train\/val","#","Starts","iterating","through","training","data","from","the","beginning","iterator.switch_to_train_data","(","sess",")","while","True",":","try",":","train_batch_","=","sess.run","(","batch",")","except","tf.errors.OutOfRangeError",":","print","(","``","End","of","training","epoch",".","''",")","#","Starts","iterating","through","val","data","from","the","beginning","iterator.switch_to_val_dataset","(","sess",")","while","True",":","try",":","val_batch_","=","sess.run","(","batch",")","except","tf.errors.OutOfRangeError",":","print","(","``","End","of","val","epoch",".","''",")"]
docstr: Starts to iterate through val data (from the beginning).
  
  Args:
      sess: The current tf session.
docstr_tok: ["Starts","to","iterate","through","val","data","(","from","the","beginning",")",".","Args",":","sess",":","The","current","tf","session","."]
code: def switch_to_val_data(self, sess):
      """Starts to iterate through val data (from the beginning).
  
      Args:
          sess: The current tf session.
      """
      if self._val_name not in self._datasets:
          raise ValueError("Val data not provided.")
      self.switch_to_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 3 for calling the TrainTestDataIterator obj's underlying member method code with example usage: obj.switch_to_val_data(sess) without return types