-
Notifications
You must be signed in to change notification settings - Fork 209
IndexError:too many indices for tensor of dimension 1 #46
Comments
I'm getting the same error.. Were you able to fix it ? |
sorry. I don't fix it. If u solve it, plz help me to do this. |
okay, I will try. |
hi, have you solved this problem? Or have you run this model? And ,are u a chinese? if you are ,can i get your we chat? thx!
…------------------ 原始邮件 ------------------
发件人: "RachelYG"<[email protected]>;
发送时间: 2019年4月16日(星期二) 晚上7:36
收件人: "facebookresearch/clevr-iep"<[email protected]>;
抄送: "1245994042"<[email protected]>; "Author"<[email protected]>;
主题: Re: [facebookresearch/clevr-iep] IndexError:too many indices fortensor of dimension 1 (#46)
okay, I will try.
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub, or mute the thread.
|
I have sent an email to you. |
But i didn't get any email… |
change the seq2seq.py > function reinforce_sample > forloop into for t in range(T): |
Hi |
@PuPuLL I have solved it. My above comment is the code. The problem is that the different supports of indexing a tensor array in Pytorch 0.1 and Pytorch 0.4. |
OK,I will try it. Thx! |
sorry,I just got the message. |
that works! thank you |
Hi, I am using python 3.4 and pytorch 1.1.0 Traceback (most recent call last): I have print f which is |
@AishaAlaagib The underlying root cause here is that this code was written using a very old version of PyTorch (I think maybe 0.2?), and there have been a bunch of breaking changes to PyTorch since then which means that the code makes many assumptions about the shapes and types of tensors which will not hold in more recent PyTorch releases. For this error in particular, the module network implements forward passes for a couple different types of program representations, and tries to route to the correct implementation based on the type and shape of the In this case, it looks like this line got executed: https://github.com/facebookresearch/clevr-iep/blob/master/iep/models/module_net.py#L234 (which expects the program to be in some JSON format); however based on your output from You should debug around here to see why the wrong branch of this condition executed. |
@jcjohnson Thanks alot. you are right the problem in the pytorch version. So it works now. Thanks again. |
我解决了这个问题,现在他可以很好的run在torch1.7 以及cuda 11以上版本了 |
I used python 3.5 and pytorch 0.4.
At first, I got RuntimeError: dimension out of range (expected to be in range of [-1, 0], but got 1) at seq2seq.py, line 57, in get_dims
T_out = y.size(1) if y is not None else None
After i change seq2seq model line 173
if argmax:
_, cur_output = probs.max(1)
else:
to
if argmax:
_, cur_output = probs.max(1)
cur_output = cur_output.unsqueeze(0)
else:
as commented by manoja328, I got the IndexError : too many indices for tensor of dimension 1 ,at seq2seq.py, line 182,
in reinforce_sample y[:, t][not_done] = cur_output_data[not_done]
Thank you!
The text was updated successfully, but these errors were encountered: