jcjohnson / neural-style

Torch implementation of neural style algorithm
MIT License
18.31k stars 2.7k forks source link

attempt to index field 'nn' (a nil value) #83

Open kevinkingo opened 8 years ago

kevinkingo commented 8 years ago

I am using a GTX Titan X to train the network. The thing goes fine for CPU training, but for GPU, it comes up with the following error:

Setting up style layer      2   :   relu1_1 
/home/torch/torch/install/bin/luajit: .../torch/install/share/lua/5.1/nn/SpatialConvolutionMM.lua:73: attempt to index field 'nn' (a nil value)
stack traceback:
    .../torch/install/share/lua/5.1/nn/SpatialConvolutionMM.lua:73: in function 'updateOutput'
    /home/torch/torch/install/share/lua/5.1/nn/Sequential.lua:44: in function 'forward'
    neural_style.lua:169: in function 'main'
    neural_style.lua:456: in main chunk
    [C]: in function 'dofile'
    ...orch/torch/install/lib/luarocks/rocks/trepl/scm-1/bin/th:145: in main chunk
    [C]: at 0x00406670

After some digging, it found that the variable "content_image_caffe" loss the module 'nn' after transfer to GPU memory:

print(content_image_caffe.nn) --This exists
content_image_caffe = content_image_caffe:cuda()
print(content_image_caffe.nn) --This is nil

Does anyone know how to fix this issue? Thank you.

hermitman commented 8 years ago

Hi,

How did you solve the problem afterall?

Thanks

DanDaDaDanDan commented 8 years ago

Would love to hear the answer to this as well :)