{"action":"created","issue":{"url":"https://api.github.com/repos/tensorflow/tensorflow/issues/418","labels_url":"https://api.github.com/repos/tensorflow/tensorflow/issues/418/labels{/name}","comments_url":"https://api.github.com/repos/tensorflow/tensorflow/issues/418/comments","events_url":"https://api.github.com/repos/tensorflow/tensorflow/issues/418/events","html_url":"https://github.com/tensorflow/tensorflow/issues/418","id":120573591,"number":418,"title":"Tensor slice or indexing with tensor i, j ","user":{"login":"hugman","id":2958929,"avatar_url":"https://avatars.githubusercontent.com/u/2958929?v=3","gravatar_id":"","url":"https://api.github.com/users/hugman","html_url":"https://github.com/hugman","followers_url":"https://api.github.com/users/hugman/followers","following_url":"https://api.github.com/users/hugman/following{/other_user}","gists_url":"https://api.github.com/users/hugman/gists{/gist_id}","starred_url":"https://api.github.com/users/hugman/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hugman/subscriptions","organizations_url":"https://api.github.com/users/hugman/orgs","repos_url":"https://api.github.com/users/hugman/repos","events_url":"https://api.github.com/users/hugman/events{/privacy}","received_events_url":"https://api.github.com/users/hugman/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":3,"created_at":"2015-12-05T17:25:45Z","updated_at":"2015-12-07T02:34:55Z","closed_at":null,"body":"What I want to do is retrieving(or slicing 1-element) from tensor with tensor indices.\r\n\r\nfor example, \r\n\r\n```\r\ndata = tf.constant( [ [1,2,3], [4,5,6] ] )\r\ni = tf.constant(2)\r\nj = tf.constant(1)\r\n\r\nk = data[i,j]    # error\r\nl = tf.gather( tf.gather(data, i) , j) # ok. but generate errors when gradient optimization process..\r\n```\r\n\r\n<code>sess.run(k, ...)</code> generates bad slice errors. \r\n```\r\n data[i,j]\r\n  File \"/usr/local/lib/python2.7/dist-packages/tensorflow/python/ops/array_ops.py\", line 129, in _SliceHelper\r\n    raise TypeError(\"Bad slice index %s of type %s\" % (s, type(s)))\r\n```\r\n<code>tf.gather</code> is ok to slice element, but it yields errors when training time (<code>tf.train.GradientDescentOptimizer.minimize</code>)\r\n\r\nAny tips to work-around this problem?"},"comment":{"url":"https://api.github.com/repos/tensorflow/tensorflow/issues/comments/162391727","html_url":"https://github.com/tensorflow/tensorflow/issues/418#issuecomment-162391727","issue_url":"https://api.github.com/repos/tensorflow/tensorflow/issues/418","id":162391727,"user":{"login":"girving","id":70511,"avatar_url":"https://avatars.githubusercontent.com/u/70511?v=3","gravatar_id":"","url":"https://api.github.com/users/girving","html_url":"https://github.com/girving","followers_url":"https://api.github.com/users/girving/followers","following_url":"https://api.github.com/users/girving/following{/other_user}","gists_url":"https://api.github.com/users/girving/gists{/gist_id}","starred_url":"https://api.github.com/users/girving/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/girving/subscriptions","organizations_url":"https://api.github.com/users/girving/orgs","repos_url":"https://api.github.com/users/girving/repos","events_url":"https://api.github.com/users/girving/events{/privacy}","received_events_url":"https://api.github.com/users/girving/received_events","type":"User","site_admin":false},"created_at":"2015-12-07T02:34:55Z","updated_at":"2015-12-07T02:34:55Z","body":"Method 1 won't work until we fix #206.  I don't know method 2 doesn't work, since you didn't include the error message."}}