Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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) #68

Open
Amyhii opened this issue Oct 3, 2017 · 1 comment

Comments

@Amyhii
Copy link

Amyhii commented Oct 3, 2017

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

@mkstmyk
Copy link

mkstmyk commented Oct 12, 2018

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants