title: Creating a tensorflow dataset that outputs a dict
body: <p>I have a dict with "metadata" for my dataset, of sort 
  <code>{'m1': array_1, 'm2': array_2, ...}.</code> Each of the arrays has shape (N, ...), where N is the number of samples.</p>
  
  <p>The question:
  Is it possible to create a <a href="https://www.tensorflow.org/api_docs/python/tf/data/Dataset" rel="noreferrer">tf.data.Dataset</a> that outputs a dictionary <code>{'meta_1': sub_array_1, 'meta_2': sub_array_2, ...}</code> for each iteration of the datasets iterator.get_next()? Here, sub_array_i should contain the ith metadata for one batch, so should have shape (batch_sz, ...).</p>
  
  <p>What I tried so far is using <a href="https://www.tensorflow.org/api_docs/python/tf/data/Dataset#from_generator" rel="noreferrer">tf.data.Dataset.from_generator()</a>, like this: </p>
  
  <pre><code>N = 100
  # dictionary of arrays:
  metadata = {'m1': np.zeros(shape=(N,2)), 'm2': np.ones(shape=(N,3,5))} 
  num_samples = N
  
  def meta_dict_gen():
      for i in range(num_samples):
          ls = {}
          for key, val in metadata.items():
              ls[key] = val[i]
          yield ls
  
  dataset = tf.data.Dataset.from_generator(meta_dict_gen, output_types=(dict))
  </code></pre>
  
  <p>The problem with this seems to be in <code>output_types=(dict)</code>. The code above throws at me a </p>
  
  <blockquote>
    <p>TypeError: Expected DataType for argument 'Tout' not &lt; class 'dict'>.</p>
  </blockquote>
  
  <hr>
  
  <p>I'm using tensorflow 1.8 and python 3.6.</p>