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

THNN.lua:109: bad argument #8 to 'v' (cannot convert 'struct THCudaTensor *' to 'int') #210

Open
yongduek opened this issue Apr 20, 2016 · 3 comments

Comments

@yongduek
Copy link

-- When it the command was run, it produced some error as soon as the L-BFGS optimization started.
-- the images used are 256x256 color

$ th neural_style.lua -style_image dali.jpg -content_image desk.jpg
[libprotobuf WARNING google/protobuf/io/coded_stream.cc:537] Reading dangerously large protocol message. If the message turns out to be larger than 1073741824 bytes, parsing will be halted for security reasons. To increase the limit (or to disable these warnings), see CodedInputStream::SetTotalBytesLimit() in google/protobuf/io/coded_stream.h.
[libprotobuf WARNING google/protobuf/io/coded_stream.cc:78] The total number of bytes read was 574671192
Successfully loaded models/VGG_ILSVRC_19_layers.caffemodel
conv1_1: 64 3 3 3
conv1_2: 64 64 3 3
conv2_1: 128 64 3 3
conv2_2: 128 128 3 3
conv3_1: 256 128 3 3
conv3_2: 256 256 3 3
conv3_3: 256 256 3 3
conv3_4: 256 256 3 3
conv4_1: 512 256 3 3
conv4_2: 512 512 3 3
conv4_3: 512 512 3 3
conv4_4: 512 512 3 3
conv5_1: 512 512 3 3
conv5_2: 512 512 3 3
conv5_3: 512 512 3 3
conv5_4: 512 512 3 3
fc6: 1 1 25088 4096
fc7: 1 1 4096 4096
fc8: 1 1 4096 1000
Setting up style layer 2 : relu1_1
Setting up style layer 7 : relu2_1
Setting up style layer 12 : relu3_1
Setting up style layer 21 : relu4_1
Setting up content layer 23 : relu4_2
Setting up style layer 30 : relu5_1
Running optimization with L-BFGS
/Users/yndk/torch/install/bin/luajit: /Users/yndk/torch/install/share/lua/5.1/nn/Container.lua:69:
In 35 module of nn.Sequential:
/Users/yndk/torch/install/share/lua/5.1/nn/THNN.lua:109: bad argument #8 to 'v' (cannot convert 'struct THCudaTensor *' to 'int')
stack traceback:
[C]: in function 'v'
/Users/yndk/torch/install/share/lua/5.1/nn/THNN.lua:109: in function 'SpatialConvolutionMM_updateGradInput'
...dk/torch/install/share/lua/5.1/nn/SpatialConvolution.lua:124: in function <...dk/torch/install/share/lua/5.1/nn/SpatialConvolution.lua:119>
[C]: in function 'xpcall'
/Users/yndk/torch/install/share/lua/5.1/nn/Container.lua:65: in function 'rethrowErrors'
/Users/yndk/torch/install/share/lua/5.1/nn/Sequential.lua:55: in function 'updateGradInput'
neural_style.lua:320: in function 'opfunc'
/Users/yndk/torch/install/share/lua/5.1/optim/lbfgs.lua:66: in function 'lbfgs'
neural_style.lua:339: in function 'main'
neural_style.lua:500: in main chunk
[C]: in function 'dofile'
...yndk/torch/install/lib/luarocks/rocks/trepl/scm-1/bin/th:145: in main chunk
[C]: at 0x010f8ffbd0

WARNING: If you see a stack trace below, it doesn't point to the place where this error occured. Please use only the one above.
stack traceback:
[C]: in function 'error'
/Users/yndk/torch/install/share/lua/5.1/nn/Container.lua:69: in function 'rethrowErrors'
/Users/yndk/torch/install/share/lua/5.1/nn/Sequential.lua:55: in function 'updateGradInput'
neural_style.lua:320: in function 'opfunc'
/Users/yndk/torch/install/share/lua/5.1/optim/lbfgs.lua:66: in function 'lbfgs'
neural_style.lua:339: in function 'main'
neural_style.lua:500: in main chunk
[C]: in function 'dofile'
...yndk/torch/install/lib/luarocks/rocks/trepl/scm-1/bin/th:145: in main chunk
[C]: at 0x010f8ffbd0

@yongduek
Copy link
Author

yongduek commented Apr 20, 2016

Solved by re-installing cunn, cunnx, nn.

  1. Re-installing cunn did produce the same error.
  2. So, nn module is re-installed. No error message occurred.
    It seems nn module has changed recently.
  • Solution: run the following command.
    $ luarockt install nn

cf: https://groups.google.com/forum/#!topic/torch7/6igs4XdoSW4

@ghwatson
Copy link

ghwatson commented Apr 21, 2016

Had the same error! Will follow up if I can work it out with your soultion yongduek :)

Follow-up: luarocks install nn did indeed fix the issue :D

@olahaye74
Copy link

reinstalling torch-nn and deps solved the problem for me as well.

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

3 participants