{"action":"opened","issue":{"url":"https://api.github.com/repos/pytorch/pytorch/issues/15735","repository_url":"https://api.github.com/repos/pytorch/pytorch","labels_url":"https://api.github.com/repos/pytorch/pytorch/issues/15735/labels{/name}","comments_url":"https://api.github.com/repos/pytorch/pytorch/issues/15735/comments","events_url":"https://api.github.com/repos/pytorch/pytorch/issues/15735/events","html_url":"https://github.com/pytorch/pytorch/issues/15735","id":395993010,"node_id":"MDU6SXNzdWUzOTU5OTMwMTA=","number":15735,"title":"torch.bincount() seems problematic","user":{"login":"gkioxari","id":4369065,"node_id":"MDQ6VXNlcjQzNjkwNjU=","avatar_url":"https://avatars2.githubusercontent.com/u/4369065?v=4","gravatar_id":"","url":"https://api.github.com/users/gkioxari","html_url":"https://github.com/gkioxari","followers_url":"https://api.github.com/users/gkioxari/followers","following_url":"https://api.github.com/users/gkioxari/following{/other_user}","gists_url":"https://api.github.com/users/gkioxari/gists{/gist_id}","starred_url":"https://api.github.com/users/gkioxari/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gkioxari/subscriptions","organizations_url":"https://api.github.com/users/gkioxari/orgs","repos_url":"https://api.github.com/users/gkioxari/repos","events_url":"https://api.github.com/users/gkioxari/events{/privacy}","received_events_url":"https://api.github.com/users/gkioxari/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2019-01-04T16:48:58Z","updated_at":"2019-01-04T16:48:58Z","closed_at":null,"author_association":"NONE","body":"## Problematic torch.bincount() when running on indexed arrays\r\n\r\nHere is a code snippet that reproduces some of the errors with bincount()\r\n\r\n```\r\nimport torch\r\nall0s = torch.zeros((32, ), dtype=torch.int64)\r\nall0s.bincount()\r\n# answer is tensor([32])\r\nall0s = torch.zeros((32, 2), dtype=torch.int64)\r\nall0s[:, 0].bincount()\r\n# answer is tensor([31]). This is wrong! The same command also some times exits with segfault\r\n\r\nall1s = torch.ones((32, 2), dtype=torch.int64)\r\nall1s[:, 0].bincount()\r\n# answer is tensor([ 2, 29]). Very wrong!\r\n\r\nall0s[:, 0].clone().bincount()\r\n# answer is tensor([32]). This is now correct!\r\n```\r\n\r\n"}}
{"actor":{"display_login":"gkioxari"}}