{"action":"created","issue":{"url":"https://api.github.com/repos/tensorflow/tensorflow/issues/5609","repository_url":"https://api.github.com/repos/tensorflow/tensorflow","labels_url":"https://api.github.com/repos/tensorflow/tensorflow/issues/5609/labels{/name}","comments_url":"https://api.github.com/repos/tensorflow/tensorflow/issues/5609/comments","events_url":"https://api.github.com/repos/tensorflow/tensorflow/issues/5609/events","html_url":"https://github.com/tensorflow/tensorflow/issues/5609","id":189281953,"number":5609,"title":"Add documentation on how to use bucketing functions","user":{"login":"sonalgupta","id":4138767,"avatar_url":"https://avatars.githubusercontent.com/u/4138767?v=3","gravatar_id":"","url":"https://api.github.com/users/sonalgupta","html_url":"https://github.com/sonalgupta","followers_url":"https://api.github.com/users/sonalgupta/followers","following_url":"https://api.github.com/users/sonalgupta/following{/other_user}","gists_url":"https://api.github.com/users/sonalgupta/gists{/gist_id}","starred_url":"https://api.github.com/users/sonalgupta/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sonalgupta/subscriptions","organizations_url":"https://api.github.com/users/sonalgupta/orgs","repos_url":"https://api.github.com/users/sonalgupta/repos","events_url":"https://api.github.com/users/sonalgupta/events{/privacy}","received_events_url":"https://api.github.com/users/sonalgupta/received_events","type":"User","site_admin":false},"labels":[{"id":404586594,"url":"https://api.github.com/repos/tensorflow/tensorflow/labels/awaiting%20googler","name":"awaiting googler","color":"b60205","default":false},{"id":284443156,"url":"https://api.github.com/repos/tensorflow/tensorflow/labels/type:docs","name":"type:docs","color":"c7def8","default":false}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":4,"created_at":"2016-11-15T02:20:04Z","updated_at":"2016-11-15T17:58:45Z","closed_at":null,"body":"Can someone please add documentation on how to use _tensorflow.contrib.training.bucket_ and _tensorflow.contrib.training.bucket_by_sequence_length_ functions?\r\n\r\nNOTE: Only file GitHub issues for bugs and feature requests.  All other topics will be closed.\r\n\r\nFor general support from the community, see [StackOverflow](https://stackoverflow.com/questions/tagged/tensorflow).\r\nTo make bugs and feature requests more easy to find and organize, we close issues that are deemed\r\nout of scope for GitHub Issues and point people to StackOverflow.\r\n\r\nFor bugs or installation issues, please provide the following information.\r\nThe more information you provide, the more easily we will be able to offer\r\nhelp and advice.\r\n\r\n### What related GitHub issues or StackOverflow threads have you found by searching the web for your problem?\r\n\r\n### Environment info\r\nOperating System: Mac OS X Sierra\r\n\r\nInstalled version of CUDA and cuDNN: None\r\n(please attach the output of `ls -l /path/to/cuda/lib/libcud*`):\r\n\r\nIf installed from binary pip package, provide:\r\n\r\n1. A link to the pip package you installed: Mac OS X Python 2.7 CPU\r\n2. The output from `python -c \"import tensorflow; print(tensorflow.__version__)\"`.: 0.11.0rc1\r\n\r\nIf installed from source, provide \r\n\r\n1. The commit hash (`git rev-parse HEAD`)\r\n2. The output of `bazel version`\r\n\r\n### If possible, provide a minimal reproducible example (We usually don't have time to read hundreds of lines of your code)\r\n\r\n\r\n### What other attempted solutions have you tried?\r\n\r\n\r\n### Logs or other output that would be helpful\r\n(If logs are large, please upload as attachment or provide link).\r\n"},"comment":{"url":"https://api.github.com/repos/tensorflow/tensorflow/issues/comments/260716613","html_url":"https://github.com/tensorflow/tensorflow/issues/5609#issuecomment-260716613","issue_url":"https://api.github.com/repos/tensorflow/tensorflow/issues/5609","id":260716613,"user":{"login":"sonalgupta","id":4138767,"avatar_url":"https://avatars.githubusercontent.com/u/4138767?v=3","gravatar_id":"","url":"https://api.github.com/users/sonalgupta","html_url":"https://github.com/sonalgupta","followers_url":"https://api.github.com/users/sonalgupta/followers","following_url":"https://api.github.com/users/sonalgupta/following{/other_user}","gists_url":"https://api.github.com/users/sonalgupta/gists{/gist_id}","starred_url":"https://api.github.com/users/sonalgupta/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sonalgupta/subscriptions","organizations_url":"https://api.github.com/users/sonalgupta/orgs","repos_url":"https://api.github.com/users/sonalgupta/repos","events_url":"https://api.github.com/users/sonalgupta/events{/privacy}","received_events_url":"https://api.github.com/users/sonalgupta/received_events","type":"User","site_admin":false},"created_at":"2016-11-15T17:58:45Z","updated_at":"2016-11-15T17:58:45Z","body":"Also, the following code doesn't function as I would expect. I'm sure I am missing something, which is not clear from the documentation.\r\n\r\nFor the following code:\r\n\r\n`seq_lengths = np.array([6, 3, 2])\r\ninputs = []\r\ninputs.append(tf.convert_to_tensor(np.array([2,3,3,3,3,3])))\r\ninputs.append(tf.convert_to_tensor(np.array([2, 3, 4])))\r\ninputs.append(tf.convert_to_tensor(np.array([3, 4])))\r\n\r\nsequences, output = bucket_by_sequence_length(input_length=seq_lengths, tensors= inputs, batch_size=2, bucket_boundaries =[1, 2], allow_smaller_final_batch=True,\r\n                                              dynamic_pad=True, capacity=2)\r\n\r\n# Create the graph, etc.\r\ninit_op = tf.initialize_all_variables()\r\n\r\n# Create a session for running operations in the Graph.\r\nsess = tf.Session()\r\n\r\n# Initialize the variables (like the epoch counter).\r\nsess.run(init_op)\r\n\r\n# Start input enqueue threads.\r\ncoord = tf.train.Coordinator()\r\nthreads = tf.train.start_queue_runners(sess=sess, coord=coord)\r\n\r\ntry:\r\n    while not coord.should_stop():\r\n        # Run training steps or whatever\r\n        s, o= sess.run([sequences, output])\r\n\r\nexcept tf.errors.OutOfRangeError:\r\n    print('Done training -- epoch limit reached')\r\nfinally:\r\n    # When done, ask the threads to stop.\r\n    coord.request_stop()\r\n\r\n# Wait for threads to finish.\r\ncoord.join(threads)\r\nsess.close()\r\n`\r\n\r\n`o` is `[array([[2, 3, 3, 3, 3, 3],\r\n       [2, 3, 3, 3, 3, 3]]), array([[2, 3, 4],\r\n       [2, 3, 4]]), array([[3, 4],\r\n       [3, 4]])]` however, I was expecting the tensors of lengths 3 and 6 to be in the same bucket."}}
{"actor":{"display_login":"sonalgupta"}}