wojciechz / learning_to_execute

Learning to Execute
Apache License 2.0
480 stars 115 forks source link

Does anybody have a problem when executing on GPU? #11

Closed yjy765 closed 8 years ago

yjy765 commented 8 years ago

It does work well on CPU. However it doesn't on GPU.

When I call 'th main.lua' (i.e I use GPU cause default value of gpuidx = 1)

it says

/home/yjy765/torch/install/bin/luajit: /home/yjy765/torch/install/share/lua/5.1/nn/Linear.lua:55: invalid arguments: CudaTensor number CudaTensor number DoubleTensor CudaTensor expected arguments: CudaTensor~2D [CudaTensor~2D] [float] CudaTensor~2D CudaTensor~2D | CudaTensor~2D float [CudaTensor~2D] float CudaTensor~2D CudaTensor~2D stack traceback: [C]: in function 'addmm' /home/yjy765/torch/install/share/lua/5.1/nn/Linear.lua:55: in function 'func' ...e/yjy765/torch/install/share/lua/5.1/nngraph/gmodule.lua:275: in function 'neteval' ...e/yjy765/torch/install/share/lua/5.1/nngraph/gmodule.lua:310: in function 'forward' main.lua:127: in function 'fp' main.lua:166: in function 'opfunc' /home/yjy765/torch/install/share/lua/5.1/optim/sgd.lua:44: in function 'sgd' main.lua:292: in function 'main' main.lua:336: in main chunk [C]: in function 'dofile' ...y765/torch/install/lib/luarocks/rocks/trepl/scm-1/bin/th:145: in main chunk [C]: at 0x00406670

I tried to fix but failed.

I wish somebody explain me how to fix it

yjy765 commented 8 years ago

I fixed it out.

I think every code including ':cuda()' should be replaced with assigning to each variable and state.data should be transferred to GPU with ':cuda()'