You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Nov 20, 2023. It is now read-only.
I am trying to run code using python 3.5 and I have pytorch 0.4.1 installed. I always end up getting error below:
Traceback (most recent call last):
File "train.py", line 205, in
hidden_list = repackage_hidden(hidden_list)
File "train.py", line 94, in repackage_hidden
return tuple(repackage_hidden(v) for v in h)
File "train.py", line 94, in
return tuple(repackage_hidden(v) for v in h)
File "train.py", line 94, in repackage_hidden
return tuple(repackage_hidden(v) for v in h)
File "train.py", line 94, in
return tuple(repackage_hidden(v) for v in h)
File "train.py", line 94, in repackage_hidden
return tuple(repackage_hidden(v) for v in h)
File "train.py", line 94, in
return tuple(repackage_hidden(v) for v in h)
File "train.py", line 94, in repackage_hidden
return tuple(repackage_hidden(v) for v in h)
File "train.py", line 94, in
return tuple(repackage_hidden(v) for v in h)
File "train.py", line 94, in repackage_hidden
return tuple(repackage_hidden(v) for v in h)
File "/home/usr/.local/lib/python3.5/site-packages/torch/tensor.py", line 381, in iter
raise TypeError('iteration over a 0-d tensor')
TypeError: iteration over a 0-d tensor
The text was updated successfully, but these errors were encountered:
@SabaMehmood15 ,
I initially had the same error (on python 2.7, pytorch 0.4.1), the readme does say they tested on pytorch 0.3.0 and python 2.7. After downgrading pytorch it worked fine for me.
Modify 'type(h) == Variable' to 'type(h) == torch.Tensor'
#-- helper func for rnn units
def repackage_hidden(h):
"""Wraps hidden states in new Variables, to detach them from their history."""
# if type(h) == Variable:
# return Variable(h.data)
if type(h) == torch.Tensor:
return Variable(h.data)
else:
return tuple(repackage_hidden(v) for v in h)
Sign up for freeto subscribe to this conversation on GitHub.
Already have an account?
Sign in.
I am trying to run code using python 3.5 and I have pytorch 0.4.1 installed. I always end up getting error below:
Traceback (most recent call last):
File "train.py", line 205, in
hidden_list = repackage_hidden(hidden_list)
File "train.py", line 94, in repackage_hidden
return tuple(repackage_hidden(v) for v in h)
File "train.py", line 94, in
return tuple(repackage_hidden(v) for v in h)
File "train.py", line 94, in repackage_hidden
return tuple(repackage_hidden(v) for v in h)
File "train.py", line 94, in
return tuple(repackage_hidden(v) for v in h)
File "train.py", line 94, in repackage_hidden
return tuple(repackage_hidden(v) for v in h)
File "train.py", line 94, in
return tuple(repackage_hidden(v) for v in h)
File "train.py", line 94, in repackage_hidden
return tuple(repackage_hidden(v) for v in h)
File "train.py", line 94, in
return tuple(repackage_hidden(v) for v in h)
File "train.py", line 94, in repackage_hidden
return tuple(repackage_hidden(v) for v in h)
File "/home/usr/.local/lib/python3.5/site-packages/torch/tensor.py", line 381, in iter
raise TypeError('iteration over a 0-d tensor')
TypeError: iteration over a 0-d tensor
The text was updated successfully, but these errors were encountered: