hart-pytorch icon indicating copy to clipboard operation
hart-pytorch copied to clipboard

dimension out of range (expected to be in range of [-1, 0], but got 1)

Open huiyang865 opened this issue 6 years ago • 1 comments

Hi, When I run the main.py file to execute the model, an error appears: Traceback (most recent call last): File "/home/robert/Downloads/pycharm-2018.1.3/helpers/pydev/pydevd.py", line 1664, in main() File "/home/robert/Downloads/pycharm-2018.1.3/helpers/pydev/pydevd.py", line 1658, in main globals = debugger.run(setup['file'], None, None, is_module) File "/home/robert/Downloads/pycharm-2018.1.3/helpers/pydev/pydevd.py", line 1068, in run pydev_imports.execfile(file, globals, locals) # execute the script File "/home/robert/Downloads/pycharm-2018.1.3/helpers/pydev/_pydev_imps/_pydev_execfile.py", line 18, in execfile exec(compile(contents+"\n", file, 'exec'), glob, loc) File "/home/robert/Documents/hart-pytorch/main.py", line 164, in images, bboxes[:, 0], presences[:, 0]) File "/home/robert/anaconda3/envs/pytorch_p3/lib/python3.6/site-packages/torch/nn/modules/module.py", line 491, in call result = self.forward(*input, **kwargs) File "/home/robert/Documents/hart-pytorch/hart.py", line 47, in forward dfn_l2s, raw_glims = [T.stack(o, 1) for o in zip(*outputs)] File "/home/robert/Documents/hart-pytorch/hart.py", line 47, in dfn_l2s, raw_glims = [T.stack(o, 1) for o in zip(*outputs)] RuntimeError: dimension out of range (expected to be in range of [-1, 0], but got 1)

Why?

huiyang865 avatar Aug 20 '18 08:08 huiyang865

I have debugged the code. The parameter of outputs is a list. And the dimension of outputs[i][7] (i=0,1...,29) is just 1, so there is an error for the operation T.stack(o, 1).

I cannot understand what the reason for the one dimension of outputs[i][7]. Can you help me? Thanks.

huiyang865 avatar Aug 24 '18 11:08 huiyang865