e-lab/ENet-training

lua/5.2/nn/JoinTable.lua:38: bad argument #1 to 'copy' (sizes do not match at /home/user/torch/extra/cutorch/lib/THC/THCTensorCopy.cu:31)

Amyhii opened this issue · 1 comments

While trying to reproduce the results of the paper "Context Encoders: Feature Learning by Inpainting", using the torch code available in Github repositories with adversarial loss, I got the following error:
In 2 module of nn.Sequential:
/home/user/torch/install/share/lua/5.2/nn/JoinTable.lua:38: bad argument #1 to 'copy' (sizes do not match at /home/user/torch/extra/cutorch/lib/THC/THCTensorCopy.cu:31)
stack traceback:
[C]: in function 'copy'
/home/user/torch/install/share/lua/5.2/nn/JoinTable.lua:38: in function </home/user/torch/install/share/lua/5.2/nn/JoinTable.lua:21>
[C]: in function 'xpcall'
/home/rajiv/torch/install/share/lua/5.2/nn/Container.lua:63: in function 'rethrowErrors'
/home/user/torch/install/share/lua/5.2/nn/Sequential.lua:44: in function </home/user/torch/install/share/lua/5.2/nn/Sequential.lua:41>
(...tail calls...)
train_random.lua:396: in function 'opfunc'
/home/user/torch/install/share/lua/5.2/optim/adam.lua:37: in function 'adam'
train_random.lua:526: in main chunk

WARNING: If you see a stack trace below, it doesn't point to the place where this error occurred. Please use only the one above.
stack traceback:
[C]: in function 'error'
/home/user/torch/install/share/lua/5.2/nn/Container.lua:67: in function 'rethrowErrors'
/home/user/torch/install/share/lua/5.2/nn/Sequential.lua:44: in function </home/user/torch/install/share/lua/5.2/nn/Sequential.lua:41>
(...tail calls...)
train_random.lua:396: in function 'opfunc'
/home/user/torch/install/share/lua/5.2/optim/adam.lua:37: in function 'adam'
train_random.lua:526: in main chunk
Debugging session completed (traced 1 instruction).
Program completed in 24.07 seconds (pid: 10940).

The above error was produced in the code: netD:forward({masked_data, real_data})
Running the code with only the mse loss without considering the adversarial loss works fine. I updated nn network using " luarocks install nn " (as suggested in some of the blogs) but the problem persists. Any help or comment regarding the problem would be appreciated.
Thanks in advance

I'm also getting similar error:

/torch/install/share/lua/5.1/nn/JoinTable.lua:39: bad argument #1 to 'copy' (sizes do not match at /cutorch/lib/THC/THCTensorCopy.cu:31)

I checked some closed issues like this, but couldn't find exact solution for me.

In my case, I'm just trying to test the provided model, model-cityscapes.net, by following code:

require 'nn'
require 'image'
require 'cunn'
require 'cudnn'
torch.setdefaulttensortype('torch.FloatTensor')
test_img = 'data/cityscape.png'
network = 'data/model-cityscapes.net'
net = torch.load(network)
im = image.load(test_img)
im2 = image.scale(im, 1024, 512)
im2 = im2:cuda()
output = net:forward(im2)

The error occurs at the last line.
I think the image is scaled appropriately for model-cityscapes.net.
I really appreciate if someone give me some comments or suggestions.
Thank you.