{"action":"created","issue":{"url":"https://api.github.com/repos/tensorflow/tensorflow/issues/2323","repository_url":"https://api.github.com/repos/tensorflow/tensorflow","labels_url":"https://api.github.com/repos/tensorflow/tensorflow/issues/2323/labels{/name}","comments_url":"https://api.github.com/repos/tensorflow/tensorflow/issues/2323/comments","events_url":"https://api.github.com/repos/tensorflow/tensorflow/issues/2323/events","html_url":"https://github.com/tensorflow/tensorflow/issues/2323","id":154251234,"number":2323,"title":"the process wil be so slow when reading batch data from csv files in tensorflow","user":{"login":"liumilan","id":5533901,"avatar_url":"https://avatars.githubusercontent.com/u/5533901?v=3","gravatar_id":"","url":"https://api.github.com/users/liumilan","html_url":"https://github.com/liumilan","followers_url":"https://api.github.com/users/liumilan/followers","following_url":"https://api.github.com/users/liumilan/following{/other_user}","gists_url":"https://api.github.com/users/liumilan/gists{/gist_id}","starred_url":"https://api.github.com/users/liumilan/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/liumilan/subscriptions","organizations_url":"https://api.github.com/users/liumilan/orgs","repos_url":"https://api.github.com/users/liumilan/repos","events_url":"https://api.github.com/users/liumilan/events{/privacy}","received_events_url":"https://api.github.com/users/liumilan/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":{"login":"mrry","id":192142,"avatar_url":"https://avatars.githubusercontent.com/u/192142?v=3","gravatar_id":"","url":"https://api.github.com/users/mrry","html_url":"https://github.com/mrry","followers_url":"https://api.github.com/users/mrry/followers","following_url":"https://api.github.com/users/mrry/following{/other_user}","gists_url":"https://api.github.com/users/mrry/gists{/gist_id}","starred_url":"https://api.github.com/users/mrry/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mrry/subscriptions","organizations_url":"https://api.github.com/users/mrry/orgs","repos_url":"https://api.github.com/users/mrry/repos","events_url":"https://api.github.com/users/mrry/events{/privacy}","received_events_url":"https://api.github.com/users/mrry/received_events","type":"User","site_admin":false},"milestone":null,"comments":2,"created_at":"2016-05-11T14:01:17Z","updated_at":"2016-05-12T13:05:46Z","closed_at":null,"body":"def read_data(filename):\r\n\r\n        filename_queue = tf.train.string_input_producer([filename])\r\n        reader = tf.TextLineReader()\r\n        key, value = reader.read(filename_queue)\r\n        record_defaults = [[1.0 for col in range(1)] for row in range(280)]\r\n        record_defaults[279][0] = 1\r\n        a = tf.decode_csv(value, record_defaults=record_defaults)\r\n        data = tf.pack(a[0:278])\r\n        label = a[-1]\r\n        min_after_dequeue = 10000\r\n        capacity = min_after_dequeue + 3 * batch_size\r\n        data_batch, label_batch = tf.train.shuffle_batch([data, label], batch_size=batch_size, capacity=capacity,min_after_dequeue=min_after_dequeue)\r\n        return data_batch, label_batch\r\n\r\n\r\ndef main(argv=None):  \r\n\r\n        data,label = read_data(FLAGS.train_file)\r\n\r\n        tf.initialize_all_variables()\r\n        with tf.Session() as sess:\r\n                coord = tf.train.Coordinator()\r\n                threads = tf.train.start_queue_runners(coord=coord)\r\n                example, label = sess.run([data, label])\r\n                print (example)\r\n\r\nHere is my code above ,why it take 10 minutes to print example data?How can I optimise my code? I have only set batchsize is 2\r\n\r\n"},"comment":{"url":"https://api.github.com/repos/tensorflow/tensorflow/issues/comments/218750799","html_url":"https://github.com/tensorflow/tensorflow/issues/2323#issuecomment-218750799","issue_url":"https://api.github.com/repos/tensorflow/tensorflow/issues/2323","id":218750799,"user":{"login":"beopst","id":10264378,"avatar_url":"https://avatars.githubusercontent.com/u/10264378?v=3","gravatar_id":"","url":"https://api.github.com/users/beopst","html_url":"https://github.com/beopst","followers_url":"https://api.github.com/users/beopst/followers","following_url":"https://api.github.com/users/beopst/following{/other_user}","gists_url":"https://api.github.com/users/beopst/gists{/gist_id}","starred_url":"https://api.github.com/users/beopst/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/beopst/subscriptions","organizations_url":"https://api.github.com/users/beopst/orgs","repos_url":"https://api.github.com/users/beopst/repos","events_url":"https://api.github.com/users/beopst/events{/privacy}","received_events_url":"https://api.github.com/users/beopst/received_events","type":"User","site_admin":false},"created_at":"2016-05-12T13:05:46Z","updated_at":"2016-05-12T13:05:46Z","body":"It is because tf.train.shuffle_batch blocks dequeue operation until the queue size reaches to min_after_dequeue. This is intended for better mixing of elements in queue to shuffle data. "}}