title: How to make a generator callable?
body: <p>I'm trying to create a dataset from a CSV file with 784-bit long rows. Here's my code:</p>
  
  <pre><code>import tensorflow as tf
  
  f = open("test.csv", "r")
  csvreader = csv.reader(f)
  gen = (row for row in csvreader)
  ds = tf.data.Dataset()
  ds.from_generator(gen, [tf.uint8]*28**2)
  </code></pre>
  
  <p>I get the following error:</p>
  
  <pre><code>---------------------------------------------------------------------------
  TypeError                                 Traceback (most recent call last)
  &lt;ipython-input-22-4b244ea66c1d&gt; in &lt;module&gt;()
       12 gen = (row for row in csvreader_pat_trn)
       13 ds = tf.data.Dataset()
  ---&gt; 14 ds.from_generator(gen, [tf.uint8]*28**2)
  
  ~/Documents/Programming/ANN/labs/lib/python3.6/site-packages/tensorflow/python/data/ops/dataset_ops.py in from_generator(generator, output_types, output_shapes)
      317     """
      318     if not callable(generator):
  --&gt; 319       raise TypeError("`generator` must be callable.")
      320     if output_shapes is None:
      321       output_shapes = nest.map_structure(
  
  TypeError: `generator` must be callable.
  </code></pre>
  
  <p>The <a href="https://www.tensorflow.org/api_docs/python/tf/data/Dataset#from_generator" rel="noreferrer">docs</a> said that I should have a generator passed to <code>from_generator()</code>, so that's what I did, <code>gen</code> is a generator. But now it's complaining that my generator isn't <strong>callable</strong>. How can I make the generator callable so I can get this to work?</p>
  
  <p><strong>EDIT:</strong>
  I'd like to add that I'm using python 3.6.4. Is this the reason for the error? </p>