limbee / NTIRE2017

Torch implementation of "Enhanced Deep Residual Networks for Single Image Super-Resolution"
655 stars 146 forks source link

torch.*Tensor expected, got table #9

Closed rickstep closed 7 years ago

rickstep commented 7 years ago

Hello,

I am running the following command:

[ec2-user@ demo]$ th test.lua -type test -dataset myData -model MDSR -scale 2 -degrade [bicubic]

I am getting the following error:

/home/ec2-user/src/torch/install/bin/luajit: /rick/ntire2017/code/utils.lua:315: bad argument #1 to 'copy' (torch.*Tensor expected, got table) stack traceback: [C]: in function 'copy' /rick/ntire2017/code/utils.lua:315: in function 'chopForward' test.lua:270: in main chunk [C]: in function 'dofile' .../src/torch/install/lib/luarocks/rocks/trepl/scm-1/bin/th:150: in main chunk [C]: at 0x004064c0

The section of code that errors is (in chopForward method in utils.lua) outputPatch[{{i, i + nGPU - 1}, {}, {}, {}}]:copy(model:forward(inputBatch))

And if I run this command

th test.lua -type test -dataset myData -model EDSR -scale 2 -degrade bicubic

I get a different error at the same section of code

/home/ec2-user/src/torch/install/bin/luajit: /rick/ntire2017/code/utils.lua:315: bad argument #1 to 'copy' (sizes do not match at /home/ec2-user/src/torch/extra/cutorch/lib/THC/THCTensorCopy.cu:31) stack traceback: [C]: in function 'copy' /rick/ntire2017/code/utils.lua:315: in function 'chopForward' test.lua:270: in main chunk [C]: in function 'dofile' .../src/torch/install/lib/luarocks/rocks/trepl/scm-1/bin/th:150: in main chunk [C]: at 0x004064c0

Any help is greatly appreciated. I am running on the Machine Learning AMI on amazon ec2.

sanghyun-son commented 7 years ago

Hello.

To test our multi-scale model, you have to include 'multiscale' in the name of your model file. (Like -model multiscale_blahblahblah.t7) Sorry for inconvinience.

This happens because MDSR itself is not directly executable in any torch code. To run the MDSR, you have to rearrange the scale-specific blocks in the model manually, or with the function like 'swap' in the test.lua. If you want to use the name MDSR, I think you can achieve this by simply modifying the demo code.

For the second issue, I will take a look and give you an answer as soon as possible.

Thank you!

rickstep commented 7 years ago

That was it. Thanks so much!