Using csv training data in tensorflow RNN
Question: I am fairly new to tensorflow, and did the obligatory MNIST tutorial
successfully.

I am trying to train a simple RNN with a set of CSV data. The data is 33
features and a binary output variable at the end (so 34 columns).

I have implemented a csv reader that reads in one line at a time. I am trying
to read that line and pass it into my tensorflow graph. I feel like the
"TensorFlow-way" is starting to become more clear but also that there are some
fundamental pieces missing - particularly as it relates to streaming data into
your model.

I have included an example of what I'm doing below. Most of the code has been
stripped for clarity, but the important part remains:

    
    
    import tensorflow as tf
    import sys
    import datapipe as datapipe
    
    learning_rate = 0.001
    n_features    = 33
    n_hidden      = 100 # number of features in the hidden layer - I just made this up
    n_classes     = 2 # 0 or 1 - a binary classification
    
    x = tf.placeholder('float', [None, 1, n_features])
    y = tf.placeholder('float', [None, n_classes])
    
    transform = tf.transpose(x)
    
    with tf.session() as sess:
      sess.run(tf.initialize_all_variables())
    
      coord   = tf.train.Coordinator()
      threads = tf.train.start_queue_runners(coord=coord)
    
      datapipe = datapipe.Datapipe(filename='training.csv', features=33, epochs=100)
    
      while not coord.should_stop():
        nextline = datapipe.nextline()
    
        # I basically want to run "transform" with the nextline of the csv file
        stuff = sess.run(transform, feed_dict={ x: nextline })
        coord.request_stop()
        coord.join(threads)
    

And `datapipe` is:

    
    
    import tensorflow as tf
    
    class Datapipe:
        def __init__(self, filename=None, features=None, epochs=100):
            self.filename = filename
            self.features = features
            self.epochs   = epochs
    
            self.defaults = []
            for i in range(self.features):
                self.defaults.append([]) # require all fields to be present
    
        def nextline(self):
            file_queue = tf.train.string_input_producer([self.filename], num_epochs=self.epochs, shuffle=False)
            reader = tf.TextLineReader()
    
            key, csv_str = reader.read(file_queue)
            return tf.pack(tf.decode_csv(csv_str, record_defaults=self.defaults))
    

When I run this example, I get the error:

`TypeError: The value of a feed cannot be a tf.Tensor object. Acceptable feed
values include Python scalars, strings, lists, or numpy ndarrays.`

Thank you for all your help!

**EDIT**

My question is essentially: _How can I feed file data (e.g. csv) into a
tensorflow model?_ (the tutorials weren't helpful)

**EDIT 12/09/2016**

Based on the answer by Sergii, I am doing this now:

    
    
    with open('../data/training2.csv') as f:
        reader = csv.reader(f)
        for line in reader:
            arr = np.array(line)
    
            x = arr[0:len(arr)-1:1]
            y = arr[len(arr)-1:len(arr):1]
    
            sess.run(transform, feed_dict={ x: x, y: y })
    


Answer: `Tensor` objects can not be values of `feed_dict`, it takes actual values,
like `numpy` arrays, strings, etc as an input. See for example [this
issue.](https://github.com/tensorflow/tensorflow/issues/3389)

Try to modify `nextline` method and do not create a `Tensor` there but
transform your csv strings into numpy arrays instead.

