Tensorflow: using an input-pipeline (.csv) as a dictionary for training

前端 未结 1 819
死守一世寂寞
死守一世寂寞 2021-01-25 09:22

I\'m trying to train a model on a .csv dataset (5008 columns, 533 rows). I\'m using a textreader to parse the data into two tensors, one holding the data to train on [example] a

相关标签:
1条回答
  • 2021-01-25 10:17

    As the error says, you are trying to feed a tensor to feed_dict. You have defined a input_pipeline queue and you cant pass it as feed_dict. The proper way for the data to be passed to the model and train is shown in the code below:

     # A queue which will return batches of inputs 
     batch_x, batch_y = input_pipeline(["Tensorflow_vectors.csv"], batch_size)
    
     # Feed it to your neural network model: 
     # Every time this is called, it will pull data from the queue.
     logits = neural_network(batch_x, batch_y, ...)
    
     # Define cost and optimizer
     cost = ...
     optimizer = ...
    
     # Evaluate the graph on a session:
     with tf.Session() as sess:
        init_op = ...
        sess.run(init_op)
    
        # Start the queues
        coord = tf.train.Coordinator()
        threads = tf.train.start_queue_runners(sess=sess, coord=coord)
    
        # Loop through data and train
        for ( loop through steps ):
            _, cost = sess.run([optimizer, cost])
    
        coord.request_stop()
        coord.join(threads) 
    
    0 讨论(0)
提交回复
热议问题