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 Oct 31, 2023. It is now read-only.
RuntimeError: expand(torch.LongTensor{[1, 1]}, size=[1]): the number of sizes provided (1) must be greater or equal to the number of dimensions in the tensor (2) at seq2seq.py, line 183, in reinforce_sample y[:, t][not_done] = cur_output_data[not_done]
#37
Open
TimeCracker opened this issue
Jul 9, 2018
· 2 comments
Hi there, when I ran the scripts as instructed, I got the RuntimeError. Below are the details:
python3 scripts/run_model.py --program_generator models/CLEVR/program_generator_18k.pt --execution_engine models/CLEVR/execution_engine_18k.pt --image img/CLEVR_val_000013.png --question "Does the small sphere have the same color as the cube left of the gray cube?"
Loading program generator from models/CLEVR/program_generator_18k.pt
Loading execution engine from models/CLEVR/execution_engine_18k.pt
Loading CNN for feature extraction
Running the model
/home/pyp/clevr-iep-master/iep/models/seq2seq.py:172: UserWarning: Implicit dimension choice for softmax has been deprecated. Change the call to include dim=X as an argument.
probs = F.softmax(logprobs.view(N, -1)) # Now N x V
Traceback (most recent call last):
File "scripts/run_model.py", line 303, in
main(args)
File "scripts/run_model.py", line 85, in main
run_single_example(args, model)
File "scripts/run_model.py", line 161, in run_single_example
argmax=(args.sample_argmax == 1))
File "/home/pyp/clevr-iep-master/iep/models/seq2seq.py", line 183, in reinforce_sample
y[:, t][not_done] = cur_output_data[not_done]
RuntimeError: expand(torch.LongTensor{[1, 1]}, size=[1]): the number of sizes provided (1) must be greater or equal to the number of dimensions in the tensor (2)
============================================================================
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 RuntimeError in the title: RuntimeError: expand(torch.LongTensor{[1, 1]}, size=[1]): the number of sizes provided (1) must be greater or equal to the number of dimensions in the tensor (2) at seq2seq.py, line 183, in reinforce_sample y[:, t][not_done] = cur_output_data[not_done]
Thank you!
The text was updated successfully, but these errors were encountered:
Hi there, when I ran the scripts as instructed, I got the RuntimeError. Below are the details:
python3 scripts/run_model.py --program_generator models/CLEVR/program_generator_18k.pt --execution_engine models/CLEVR/execution_engine_18k.pt --image img/CLEVR_val_000013.png --question "Does the small sphere have the same color as the cube left of the gray cube?"
Loading program generator from models/CLEVR/program_generator_18k.pt
Loading execution engine from models/CLEVR/execution_engine_18k.pt
Loading CNN for feature extraction
Running the model
/home/pyp/clevr-iep-master/iep/models/seq2seq.py:172: UserWarning: Implicit dimension choice for softmax has been deprecated. Change the call to include dim=X as an argument.
probs = F.softmax(logprobs.view(N, -1)) # Now N x V
Traceback (most recent call last):
File "scripts/run_model.py", line 303, in
main(args)
File "scripts/run_model.py", line 85, in main
run_single_example(args, model)
File "scripts/run_model.py", line 161, in run_single_example
argmax=(args.sample_argmax == 1))
File "/home/pyp/clevr-iep-master/iep/models/seq2seq.py", line 183, in reinforce_sample
y[:, t][not_done] = cur_output_data[not_done]
RuntimeError: expand(torch.LongTensor{[1, 1]}, size=[1]): the number of sizes provided (1) must be greater or equal to the number of dimensions in the tensor (2)
============================================================================
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 RuntimeError in the title: RuntimeError: expand(torch.LongTensor{[1, 1]}, size=[1]): the number of sizes provided (1) must be greater or equal to the number of dimensions in the tensor (2) at seq2seq.py, line 183, in reinforce_sample y[:, t][not_done] = cur_output_data[not_done]
Thank you!
The text was updated successfully, but these errors were encountered: