torch / nn

Other
1.34k stars 967 forks source link

/torch/install/share/lua/5.1/nn/LookupTable.lua:59: attempt to call method 'Contiguous' (a nil value) #1301

Open jmfu95 opened 6 years ago

jmfu95 commented 6 years ago

I want to combine two loss, softmax and kl. So i use the following code: local nll = nn.ClassNLLCriterion() local kl = nn.DistKLDivCriterion() local criterion = nn.ParallelCriterion():add(nll,0.5):add(kl) and the input is: { 1 : IntTensor - size: 75x24 2 : IntTensor - size: 75x24 } output is: { 1 : IntTensor - size: 75x1 2 : DoubleTensor - size: 75x6 } But when i run this module, i get the following error: /torch/install/share/lua/5.1/nn/LookupTable.lua:59: attempt to call method 'Contiguous' (a nil value) stack traceback: ...shedongyu/torch/install/share/lua/5.1/nn/LookupTable.lua:59: in function 'makeInputContiguous' ...shedongyu/torch/install/share/lua/5.1/nn/LookupTable.lua:72: in function 'func' ...hedongyu/torch/install/share/lua/5.1/nngraph/gmodule.lua:345: in function 'neteval' ...hedongyu/torch/install/share/lua/5.1/nngraph/gmodule.lua:380: in function 'forward' ./trainer.lua:75: in function 'opfunc' ...shedongyu/torch/install/share/lua/5.1/optim/adadelta.lua:31: in function 'optim_method' ./trainer.lua:104: in function 'train' main.lua:215: in function 'train_loop' main.lua:407: in function 'main' main.lua:420: in main chunk [C]: in function 'dofile' ...ngyu/torch/install/lib/luarocks/rocks/trepl/scm-1/bin/th:150: in main chunk [C]: at 0x00406670 I tried, but i can't fix this. Someone knows where the mistake is. Is the input wrong?