class_docstr: Creates a ParallelDataProvider. This data provider reads two datasets
  in parallel, keeping them aligned.
  
  Args:
    dataset1: The first dataset. An instance of the Dataset class.
    dataset2: The second dataset. An instance of the Dataset class.
      Can be None. If None, only `dataset1` is read.
    num_readers: The number of parallel readers to use.
    shuffle: Whether to shuffle the data sources and common queue when
      reading.
    num_epochs: The number of times each data source is read. If left as None,
      the data will be cycled through indefinitely.
    common_queue_capacity: The capacity of the common queue.
    common_queue_min: The minimum number of elements in the common queue after
      a dequeue.
    seed: The seed to use if shuffling.
class_docstr_tok: ["Creates","a","ParallelDataProvider",".","This","data","provider","reads","two","datasets","in","parallel",",","keeping","them","aligned",".","Args",":","dataset1",":","The","first","dataset",".","An","instance","of","the","Dataset","class",".","dataset2",":","The","second","dataset",".","An","instance","of","the","Dataset","class",".","Can","be","None",".","If","None",",","only","`","dataset1","`","is","read",".","num_readers",":","The","number","of","parallel","readers","to","use",".","shuffle",":","Whether","to","shuffle","the","data","sources","and","common","queue","when","reading",".","num_epochs",":","The","number","of","times","each","data","source","is","read",".","If","left","as","None",",","the","data","will","be","cycled","through","indefinitely",".","common_queue_capacity",":","The","capacity","of","the","common","queue",".","common_queue_min",":","The","minimum","number","of","elements","in","the","common","queue","after","a","dequeue",".","seed",":","The","seed","to","use","if","shuffling","."]
code: def __init__(
      self,
      dataset1,
      dataset2,
      shuffle=True,
      num_epochs=None,
      common_queue_capacity=4096,
      common_queue_min=1024,
      seed=None,
  ):
      if seed is None:
          seed = np.random.randint(10e8)
  
      _, data_source = parallel_reader.parallel_read(
          dataset1.data_sources,
          reader_class=dataset1.reader,
          num_epochs=num_epochs,
          num_readers=1,
          shuffle=False,
          capacity=common_queue_capacity,
          min_after_dequeue=common_queue_min,
          seed=seed,
      )
  
      data_target = ""
      if dataset2 is not None:
          _, data_target = parallel_reader.parallel_read(
              dataset2.data_sources,
              reader_class=dataset2.reader,
              num_epochs=num_epochs,
              num_readers=1,
              shuffle=False,
              capacity=common_queue_capacity,
              min_after_dequeue=common_queue_min,
              seed=seed,
          )
  
      # Optionally shuffle the data
      if shuffle:
          shuffle_queue = tf.RandomShuffleQueue(
              capacity=common_queue_capacity,
              min_after_dequeue=common_queue_min,
              dtypes=[tf.string, tf.string],
              seed=seed,
          )
          enqueue_ops = []
          enqueue_ops.append(
              shuffle_queue.enqueue([data_source, data_target])
          )
          tf.train.add_queue_runner(
              tf.train.QueueRunner(shuffle_queue, enqueue_ops)
          )
          data_source, data_target = shuffle_queue.dequeue()
  
      # Decode source items
      items = dataset1.decoder.list_items()
      tensors = dataset1.decoder.decode(data_source, items)
  
      if dataset2 is not None:
          # Decode target items
          items2 = dataset2.decoder.list_items()
          tensors2 = dataset2.decoder.decode(data_target, items2)
  
          # Merge items and results
          items = items + items2
          tensors = tensors + tensors2
  
      super(ParallelDataProvider, self).__init__(
          items_to_tensors=dict(zip(items, tensors)),
          num_samples=dataset1.num_samples,
      )
  
file_path: seq2seq/seq2seq/data/parallel_data_provider.py
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  from __future__ import unicode_literals
  import numpy
  import tensorflow
  from tensorflow.contrib.slim.python.slim.data import data_provider
  from tensorflow.contrib.slim.python.slim.data import parallel_reader
  from seq2seq.data import split_tokens_decoder
label_desc: Use image node_id 1 to create a new ParallelDataProvider object from inherited base classes: data_provider with example: obj = ParallelDataProvider(dataset1, dataset2, shuffle, num_epochs, common_queue_capacity, common_queue_min, seed)