{"action":"created","issue":{"url":"https://api.github.com/repos/pytorch/pytorch/issues/6217","repository_url":"https://api.github.com/repos/pytorch/pytorch","labels_url":"https://api.github.com/repos/pytorch/pytorch/issues/6217/labels{/name}","comments_url":"https://api.github.com/repos/pytorch/pytorch/issues/6217/comments","events_url":"https://api.github.com/repos/pytorch/pytorch/issues/6217/events","html_url":"https://github.com/pytorch/pytorch/issues/6217","id":310687604,"number":6217,"title":"[PyTorch] indexing by a zero-dim Tensor should slice (not copy)","user":{"login":"colesbury","id":655866,"avatar_url":"https://avatars1.githubusercontent.com/u/655866?v=4","gravatar_id":"","url":"https://api.github.com/users/colesbury","html_url":"https://github.com/colesbury","followers_url":"https://api.github.com/users/colesbury/followers","following_url":"https://api.github.com/users/colesbury/following{/other_user}","gists_url":"https://api.github.com/users/colesbury/gists{/gist_id}","starred_url":"https://api.github.com/users/colesbury/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/colesbury/subscriptions","organizations_url":"https://api.github.com/users/colesbury/orgs","repos_url":"https://api.github.com/users/colesbury/repos","events_url":"https://api.github.com/users/colesbury/events{/privacy}","received_events_url":"https://api.github.com/users/colesbury/received_events","type":"User","site_admin":false},"labels":[{"id":424131847,"url":"https://api.github.com/repos/pytorch/pytorch/labels/bug","name":"bug","color":"b60205","default":true},{"id":443484135,"url":"https://api.github.com/repos/pytorch/pytorch/labels/high%20priority","name":"high priority","color":"F22613","default":false}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":1,"created_at":"2018-04-03T04:08:59Z","updated_at":"2018-04-03T14:58:43Z","closed_at":null,"author_association":"OWNER","body":"PyTorch master\r\n\r\nCurrently, indexing a tensor by a zero-dim tensor creates a copy. We should make it return an alias.\r\n\r\n```python\r\nidx = torch.tensor(0, dtype=torch.int64)\r\nx = torch.arange(9).reshape(3, 3)\r\nx[idx].zero_()   # no effect since x[idx] copies; it should slice instead\r\nprint(x)\r\n```\r\n\r\n```\r\n 0  1  2\r\n 3  4  5\r\n 6  7  8\r\n[torch.FloatTensor of size (3,3)]\r\n```\r\n\r\n\r\nReported by lvdmaaten"},"comment":{"url":"https://api.github.com/repos/pytorch/pytorch/issues/comments/378280637","html_url":"https://github.com/pytorch/pytorch/issues/6217#issuecomment-378280637","issue_url":"https://api.github.com/repos/pytorch/pytorch/issues/6217","id":378280637,"user":{"login":"gchanan","id":3768583,"avatar_url":"https://avatars2.githubusercontent.com/u/3768583?v=4","gravatar_id":"","url":"https://api.github.com/users/gchanan","html_url":"https://github.com/gchanan","followers_url":"https://api.github.com/users/gchanan/followers","following_url":"https://api.github.com/users/gchanan/following{/other_user}","gists_url":"https://api.github.com/users/gchanan/gists{/gist_id}","starred_url":"https://api.github.com/users/gchanan/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gchanan/subscriptions","organizations_url":"https://api.github.com/users/gchanan/orgs","repos_url":"https://api.github.com/users/gchanan/repos","events_url":"https://api.github.com/users/gchanan/events{/privacy}","received_events_url":"https://api.github.com/users/gchanan/received_events","type":"User","site_admin":false},"created_at":"2018-04-03T14:58:43Z","updated_at":"2018-04-03T14:58:43Z","author_association":"CONTRIBUTOR","body":"@colesbury:\r\nShould this block 0.4?\r\n\r\nAlso, do we have a justification for this behavior we could add to the docs?  It seems what you are suggesting here is less unexpected, because people think of 0-dimensional tensors like python numbers, but one could make the case the other way too (and we did when we first implemented this)."}}
{"actor":{"display_login":"gchanan"}}