ClementPinard / FlowNetTorch

Torch implementation of Fischer et al. FlowNet training code
30 stars 6 forks source link

a problem in testing: bad argument #1 to 'copy' #3

Closed yxqlwl closed 7 years ago

yxqlwl commented 7 years ago

Having a perspective of the code. Very Good for learning and thanks again for sharing.

Currently there is a problem in testing:

"./lua/5.1/threads/threads.lua:179: [thread 1 endcallback] /home/xyin/mfof/FlowNetTorch/test.lua:123: bad argument #1 to 'copy' (sizes do not match at /home/xyin/mfof/torch/extra/cutorch/lib/THC/generic/THCTensorCopy.c:48)

stack traceback: [C]: in function 'copy' /home/xyin/mfof/FlowNetTorch/test.lua:123: in function </home/xyin/mfof/FlowNetTorch/test.lua:106> [C]: in function 'xpcall' ...yin/mfof/torch/install/share/lua/5.1/threads/threads.lua:174: in function 'dojob' ...yin/mfof/torch/install/share/lua/5.1/threads/threads.lua:264: in function 'synchronize' /home/xyin/mfof/FlowNetTorch/test.lua:71: in function 'test' main.lua:46: in main chunk [C]: in function 'dofile' ...mfof/torch/install/lib/luarocks/rocks/trepl/scm-1/bin/th:150: in main chunk [C]: at 0x00405a10"

Wondering how to solve this? Thanks

ClementPinard commented 7 years ago

Hello, thanks for your input. The error is pointing a weird part of the code. Basically you have inputs and labels tensors, to which we copy first inputsCPU and labelsCPU (samples from test dataset) and then we copy traininputsCPU and trainLabelsCPU. Normally, they should be the same size, but in any case we do a resize for inputs and labelsboth times. Apparently there has been some confusion because we didn't resize labelsto the size of trainLabelsCPU (and copied trainInputsCPU twice !) . Now it is much more normalized, and I believe it should work. Let me know how it works for you

yxqlwl commented 7 years ago

Thank you for your response. Problem has been solved:). I will go further in studying this code.