SlowFast-Networks icon indicating copy to clipboard operation
SlowFast-Networks copied to clipboard

dimension mismatch in SlowPath

Open ShiinaMitsuki opened this issue 6 years ago • 0 comments

thx for sharing the code! I just run the code with torch 1.0 python 3.6 and got the following error:

Traceback (most recent call last):
  File "/home/sobey/apps/pycharm-2018.1.3/helpers/pydev/pydevd.py", line 1664, in <module>
    main()
  File "/home/sobey/apps/pycharm-2018.1.3/helpers/pydev/pydevd.py", line 1658, in main
    globals = debugger.run(setup['file'], None, None, is_module)
  File "/home/sobey/apps/pycharm-2018.1.3/helpers/pydev/pydevd.py", line 1068, in run
    pydev_imports.execfile(file, globals, locals)  # execute the script
  File "/home/sobey/apps/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/sobey/code/project/slow_fast.pytorch/main.py", line 285, in <module>
    output = model(input_tensor)
  File "/home/sobey/miniconda2/envs/ML3/lib/python3.6/site-packages/torch/nn/modules/module.py", line 489, in __call__
    result = self.forward(*input, **kwargs)
  File "/home/sobey/code/project/slow_fast.pytorch/main.py", line 161, in forward
    slow = self.SlowPath(input[:, :, ::8, :, :], Tc)
  File "/home/sobey/code/project/slow_fast.pytorch/main.py", line 172, in SlowPath
    x = torch.cat([x, Tc[0]], dim=1)
RuntimeError: invalid argument 0: Sizes of tensors must match except in dimension 1. Got 8 and 4 in dimension 2 at /pytorch/aten/src/TH/generic/THTensorMoreMath.cpp:1333

It interupted at this code snippet:

def SlowPath(self, input, Tc):
        x = self.slow_conv1(input)
        x = self.slow_bn1(x)
        x = self.slow_relu(x)
        x = self.slow_maxpool(x)
        x = torch.cat([x, Tc[0]], dim=1)          # this line of code
        x = self.slow_res1(x)
        x = torch.cat([x, Tc[1]], dim=1)
        x = self.slow_res2(x)
        x = torch.cat([x, Tc[2]], dim=1)
        x = self.slow_res3(x)
        x = torch.cat([x, Tc[3]], dim=1)
        x = self.slow_res4(x)
        x = nn.AdaptiveAvgPool3d(1)(x)
        x = x.view(-1, x.size(1))
        return x

ShiinaMitsuki avatar Feb 21 '19 08:02 ShiinaMitsuki