Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed dimension bugs in 12_2_hello_rnn.py #49

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

kibitzing
Copy link

Error messages were

  1. "RuntimeError: dimension specified as 0 but tensor has no dimensions". (line: 24)
    --> I changed the dimension using '.view'(-1, 1)' to make the label dimension to be 1 instead of "no dimensions"
  2. "IndexError: invalid index of a 0-dim tensor. Use tensor.item() to convert a 0-dim tensor to a Python number" (line: 80)
    --> Since the output of the Cross Entropy Loss here has no dimension, deleted the index term '[0]'.

It was tested with Pytorch 1.1.

kibitzing added 2 commits June 24, 2019 01:48
Error message was 
1) "RuntimeError: dimension specified as 0 but tensor has no dimensions".  (line: 24) 
  --> changed the dimension using '.view'(-1, 1)' to make the label dimension to be 1 instead of "no dimensions"
2)"IndexError: invalid index of a 0-dim tensor. Use tensor.item() to convert a 0-dim tensor to a Python number" (line: 80)
  --> Since the output of the Cross Entropy Loss here has no dimension, deleted the index term '[0]'.

It was tested with Pytorch 1.1.
Fixed dimension bugs in 12_2_hello_rnn.py
@hunkim
Copy link
Owner

hunkim commented Jun 15, 2020

Could you check if the new merge fixed this problem? Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants