{"action":"created","issue":{"url":"https://api.github.com/repos/tensorflow/tensorflow/issues/371","labels_url":"https://api.github.com/repos/tensorflow/tensorflow/issues/371/labels{/name}","comments_url":"https://api.github.com/repos/tensorflow/tensorflow/issues/371/comments","events_url":"https://api.github.com/repos/tensorflow/tensorflow/issues/371/events","html_url":"https://github.com/tensorflow/tensorflow/issues/371","id":119303223,"number":371,"title":"Sparse tensor construction given repeated indices","user":{"login":"andyljones","id":662606,"avatar_url":"https://avatars.githubusercontent.com/u/662606?v=3","gravatar_id":"","url":"https://api.github.com/users/andyljones","html_url":"https://github.com/andyljones","followers_url":"https://api.github.com/users/andyljones/followers","following_url":"https://api.github.com/users/andyljones/following{/other_user}","gists_url":"https://api.github.com/users/andyljones/gists{/gist_id}","starred_url":"https://api.github.com/users/andyljones/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/andyljones/subscriptions","organizations_url":"https://api.github.com/users/andyljones/orgs","repos_url":"https://api.github.com/users/andyljones/repos","events_url":"https://api.github.com/users/andyljones/events{/privacy}","received_events_url":"https://api.github.com/users/andyljones/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":{"login":"ebrevdo","id":1794715,"avatar_url":"https://avatars.githubusercontent.com/u/1794715?v=3","gravatar_id":"","url":"https://api.github.com/users/ebrevdo","html_url":"https://github.com/ebrevdo","followers_url":"https://api.github.com/users/ebrevdo/followers","following_url":"https://api.github.com/users/ebrevdo/following{/other_user}","gists_url":"https://api.github.com/users/ebrevdo/gists{/gist_id}","starred_url":"https://api.github.com/users/ebrevdo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ebrevdo/subscriptions","organizations_url":"https://api.github.com/users/ebrevdo/orgs","repos_url":"https://api.github.com/users/ebrevdo/repos","events_url":"https://api.github.com/users/ebrevdo/events{/privacy}","received_events_url":"https://api.github.com/users/ebrevdo/received_events","type":"User","site_admin":false},"milestone":null,"comments":2,"created_at":"2015-11-28T15:51:15Z","updated_at":"2015-12-01T05:57:40Z","closed_at":null,"body":"TensorFlow behaves differently (and surprisingly) to SciPy when converting sparse matrices to dense matrices.\r\n\r\n```python\r\nimport tensorflow as tf\r\nimport scipy as sp\r\nimport scipy.sparse\r\n\r\ni = [0, 0]\r\nj = [0, 0]\r\nvalues = [1, 2]\r\n\r\nsp_answer = sp.sparse.coo_matrix((values, (i, j))).todense()\r\nprint(\"SciPy's answer is \" + str(sp_answer)) # prints [[3]]\r\n\r\ntf_answer = tf.sparse_to_dense([i, j], [1, 1], values, 0)\r\nprint(\"TF's answer is \" + str(tf.Session().run(tf_answer))) # prints [[2]]\r\n```\r\nSpecifically, if an index pair is repeated, then SciPy will sum the corresponding values, while TF just keeps the last value.\r\n\r\nIs this behaviour intentional or accidental? If it's intentional, I'll make a pull request to add a mention of it to the docs. If it's accidental, I'll make a pull request to fix it."},"comment":{"url":"https://api.github.com/repos/tensorflow/tensorflow/issues/comments/160862429","html_url":"https://github.com/tensorflow/tensorflow/issues/371#issuecomment-160862429","issue_url":"https://api.github.com/repos/tensorflow/tensorflow/issues/371","id":160862429,"user":{"login":"vrv","id":463737,"avatar_url":"https://avatars.githubusercontent.com/u/463737?v=3","gravatar_id":"","url":"https://api.github.com/users/vrv","html_url":"https://github.com/vrv","followers_url":"https://api.github.com/users/vrv/followers","following_url":"https://api.github.com/users/vrv/following{/other_user}","gists_url":"https://api.github.com/users/vrv/gists{/gist_id}","starred_url":"https://api.github.com/users/vrv/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/vrv/subscriptions","organizations_url":"https://api.github.com/users/vrv/orgs","repos_url":"https://api.github.com/users/vrv/repos","events_url":"https://api.github.com/users/vrv/events{/privacy}","received_events_url":"https://api.github.com/users/vrv/received_events","type":"User","site_admin":false},"created_at":"2015-12-01T05:57:40Z","updated_at":"2015-12-01T05:57:40Z","body":"So @ebrevdo, the answer is to document this difference in behavior?"}}