{"action":"created","issue":{"url":"https://api.github.com/repos/hunkim/PyTorchZeroToAll/issues/24","repository_url":"https://api.github.com/repos/hunkim/PyTorchZeroToAll","labels_url":"https://api.github.com/repos/hunkim/PyTorchZeroToAll/issues/24/labels{/name}","comments_url":"https://api.github.com/repos/hunkim/PyTorchZeroToAll/issues/24/comments","events_url":"https://api.github.com/repos/hunkim/PyTorchZeroToAll/issues/24/events","html_url":"https://github.com/hunkim/PyTorchZeroToAll/issues/24","id":321319307,"node_id":"MDU6SXNzdWUzMjEzMTkzMDc=","number":24,"title":"RuntimeError: dimension specified as 0 but tensor has no dimensions","user":{"login":"jiapei100","id":154013,"node_id":"MDQ6VXNlcjE1NDAxMw==","avatar_url":"https://avatars1.githubusercontent.com/u/154013?v=4","gravatar_id":"","url":"https://api.github.com/users/jiapei100","html_url":"https://github.com/jiapei100","followers_url":"https://api.github.com/users/jiapei100/followers","following_url":"https://api.github.com/users/jiapei100/following{/other_user}","gists_url":"https://api.github.com/users/jiapei100/gists{/gist_id}","starred_url":"https://api.github.com/users/jiapei100/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jiapei100/subscriptions","organizations_url":"https://api.github.com/users/jiapei100/orgs","repos_url":"https://api.github.com/users/jiapei100/repos","events_url":"https://api.github.com/users/jiapei100/events{/privacy}","received_events_url":"https://api.github.com/users/jiapei100/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":1,"created_at":"2018-05-08T19:36:25Z","updated_at":"2018-07-31T10:20:15Z","closed_at":null,"author_association":"NONE","body":"\r\nline 78 of 12_2_hello_rnn.py \r\nWhat's wrong with it? `loss += criterion(output, label)`\r\n\r\n> $ python 12_2_hello_rnn.py\r\n> Model(\r\n>   (rnn): RNN(5, 5, batch_first=True)\r\n> )\r\n> predicted string: lTraceback (most recent call last):\r\n>   File \"12_2_hello_rnn.py\", line 78, in <module>\r\n>     loss += criterion(output, label)\r\n>   File \"/home/jiapei/.local/lib/python3.6/site-packages/torch/nn/modules/module.py\", line 491, in __call__\r\n>     result = self.forward(*input, **kwargs)\r\n>   File \"/home/jiapei/.local/lib/python3.6/site-packages/torch/nn/modules/loss.py\", line 759, in forward\r\n>     self.ignore_index, self.reduce)\r\n>   File \"/home/jiapei/.local/lib/python3.6/site-packages/torch/nn/functional.py\", line 1442, in cross_entropy\r\n>     return nll_loss(log_softmax(input, 1), target, weight, size_average, ignore_index, reduce)\r\n>   File \"/home/jiapei/.local/lib/python3.6/site-packages/torch/nn/functional.py\", line 1328, in nll_loss\r\n>     if input.size(0) != target.size(0):\r\n> RuntimeError: dimension specified as 0 but tensor has no dimensions\r\n\r\n\r\n\r\n"},"comment":{"url":"https://api.github.com/repos/hunkim/PyTorchZeroToAll/issues/comments/409171381","html_url":"https://github.com/hunkim/PyTorchZeroToAll/issues/24#issuecomment-409171381","issue_url":"https://api.github.com/repos/hunkim/PyTorchZeroToAll/issues/24","id":409171381,"node_id":"MDEyOklzc3VlQ29tbWVudDQwOTE3MTM4MQ==","user":{"login":"lauraliu61b","id":35935542,"node_id":"MDQ6VXNlcjM1OTM1NTQy","avatar_url":"https://avatars0.githubusercontent.com/u/35935542?v=4","gravatar_id":"","url":"https://api.github.com/users/lauraliu61b","html_url":"https://github.com/lauraliu61b","followers_url":"https://api.github.com/users/lauraliu61b/followers","following_url":"https://api.github.com/users/lauraliu61b/following{/other_user}","gists_url":"https://api.github.com/users/lauraliu61b/gists{/gist_id}","starred_url":"https://api.github.com/users/lauraliu61b/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lauraliu61b/subscriptions","organizations_url":"https://api.github.com/users/lauraliu61b/orgs","repos_url":"https://api.github.com/users/lauraliu61b/repos","events_url":"https://api.github.com/users/lauraliu61b/events{/privacy}","received_events_url":"https://api.github.com/users/lauraliu61b/received_events","type":"User","site_admin":false},"created_at":"2018-07-31T10:20:15Z","updated_at":"2018-07-31T10:20:15Z","author_association":"NONE","body":"I guess another possible solution is to replace the original label at line 78 with torch.LongTensor([label])."}}
{"actor":{"display_login":"lauraliu61b"}}