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

TypeError: iteration over a 0-d tensor #9

Closed
Machine-Tom opened this issue Jun 24, 2019 · 1 comment
Closed

TypeError: iteration over a 0-d tensor #9

Machine-Tom opened this issue Jun 24, 2019 · 1 comment

Comments

@Machine-Tom
Copy link

File "main_dev.py", line 99, in repackage_hidden
return [repackage_hidden(state) for state in h]
File "/Users/admin/anaconda3/lib/python3.7/site-packages/torch/tensor.py", line 381, in iter
raise TypeError('iteration over a 0-d tensor')
TypeError: iteration over a 0-d tensor

Have you met this kind of question before?

@rdspring1
Copy link
Owner

Did you print the shape of the h variable? It is a recursive function, so there might be a corner case that needs to be fixed. You get this error when h is an empty tensor.

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

No branches or pull requests

2 participants