facebookresearch / clevr-iep

Inferring and Executing Programs for Visual Reasoning
Other
798 stars 210 forks source link

RuntimeError: inconsistent tensor size #36

Open lixiangpengcs opened 6 years ago

lixiangpengcs commented 6 years ago

According to others' advice i modified these part:

  1. File "/home/lxp/CodeBase/VisualReasoning/clevr-iep/iep/models/seq2seq.py", line 154, in sample y.append(next_y[0, 0, 0]) ===> y.append(next_y[0, 0])
  2. add cur_output = cur_output.unsqueeze(0) to seq2seq.py, line 175, in sample

But there is a new error in training step 3 (PG+EE):

Traceback (most recent call last): File "scripts/train_model.py", line 490, in main(args) File "scripts/train_model.py", line 151, in main train_loop(args, train_loader, val_loader) File "scripts/train_model.py", line 239, in train_loop programs_pred = program_generator.reinforce_sample(questions_var) File "/home/lxp/CodeBase/VisualReasoning/clevr-iep/iep/models/seq2seq.py", line 182, in reinforce_sample y[:, t][not_done] = cur_output_data[not_done] RuntimeError: inconsistent tensor size, expected src [64 x 1] and mask [64 x 64] to have the same number of elements, but got 64 and 4096 elements respectively at /opt/conda/conda-bld/pytorch_1513368888240/work/torch/lib/TH/generic/THTensorMath.c:197

And I don't know why. Is there any solution to solve it?

jivatneet commented 3 years ago

@lixiangpengcs were you able to resolve this?

insung3511 commented 2 years ago

has anyone solved that problem? because I got a same problem to me.