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

人盡茶涼 提交于 2019-12-02 04:34:34

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) 
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!