title: Convert a tensorflow tf.data.Dataset FlatMapDataset to TensorSliceDataset
body: <p>I want to pass a list of <code>tf.Strings</code> to the  <code>.map(_parse_function)</code> function.</p>
  <pre><code> def _parse_function(self, img_path):
          img_str = tf.read_file(img_path)
          img_decode = tf.image.decode_jpeg(img_str, channels=3)
          img_decode = tf.divide(tf.cast(img_decode , tf.float32),255)
          return img_decode
  </code></pre>
  <p>When the <code>tf.data.Dataset</code> is of type <code>TensorSliceDataset</code>,</p>
  <pre><code>dataset_from_slices = tf.data.Dataset.from_tensor_slices((tensor_with_filenames))
  </code></pre>
  <p>I can simply do
  <code>dataset_from_slices.map(_parse_function</code>), which works.</p>
  <p>However, <code>dataset_from_generator = tf.data.Dataset.from_generator(...)</code> returns a <code>Dataset</code> which is an instance of <code>FlatMapDataset</code> type and <code>dataset_from_generator.map(_parse_function)</code> gives the following error:</p>
  <pre><code>InvalidArgumentError: Input filename tensor must be scalar, but had shape: [32]
  </code></pre>
  <p>If I change the first line to:</p>
  <pre><code>img_str = tf.read_file(img_path[0])
  </code></pre>
  <p>that also works but then I only get the first image, which is not what I am looking for. Any suggestions?</p>