torch / torch7

http://torch.ch
Other
9k stars 2.38k forks source link

getParameters() problem #1179

Closed mhmtsarigul closed 6 years ago

mhmtsarigul commented 6 years ago

Hello.

I try to retrain a pretrained model with optim package. But when i call getParameters, i get an arror.

"/home/msg/torch/install/bin/luajit: /home/msg/torch/install/share/lua/5.1/nn/Module.lua:251: attempt to index a number value stack traceback: /home/msg/torch/install/share/lua/5.1/nn/Module.lua:251: in function 'flatten' /home/msg/torch/install/share/lua/5.1/nn/Module.lua:326: in function 'getParameters' /home/msg/imagenet-multiGPU.torch-master/train.lua:149: in main chunk [C]: in function 'dofile' main.lua:41: in main chunk [C]: in function 'dofile' .../msg/torch/install/lib/luarocks/rocks/trepl/scm-1/bin/th:150: in main chunk [C]: at 0x00406670 "

What can i do to fix this problem.

stu17682 commented 6 years ago

Hi Mehmet

It looks like bug in Module.lua on line 251. It might be something like this, a very basic example of the error:

x = 10

y = 5

z = x[y]

i.e. trying to assign the value at position 5 in x to z, which can't be done, since x is just the number 10 and can't be indexed. Check how you are flattening your data structures too, it looks like that is related.

Hope this helps.

Cheers!

Stuart

--

Stuart Millar

PhD Deep Learning / Cyber Security Researcher

CSIT / QUB, Belfast

smillar09@qub.ac.uk

https://www.linkedin.com/in/stuartmillar


From: mhmtsarigul notifications@github.com Sent: 30 October 2018 11:26 To: torch/torch7 Cc: Subscribed Subject: [torch/torch7] getParameters() problem (#1179)

Hello.

I try to retrain a pretrained model with optim package. But when i call getParameters, i get an arror.

"/home/msg/torch/install/bin/luajit: /home/msg/torch/install/share/lua/5.1/nn/Module.lua:251: attempt to index a number value stack traceback: /home/msg/torch/install/share/lua/5.1/nn/Module.lua:251: in function 'flatten' /home/msg/torch/install/share/lua/5.1/nn/Module.lua:326: in function 'getParameters' /home/msg/imagenet-multiGPU.torch-master/train.lua:149: in main chunk [C]: in function 'dofile' main.lua:41: in main chunk [C]: in function 'dofile' .../msg/torch/install/lib/luarocks/rocks/trepl/scm-1/bin/th:150: in main chunk [C]: at 0x00406670 "

What can i do to fix this problem.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHubhttps://github.com/torch/torch7/issues/1179, or mute the threadhttps://github.com/notifications/unsubscribe-auth/AQFdsGOKHzAoKq0Jzs4PX_SIhZWYjj5Wks5uqDdKgaJpZM4YBtyh.

mhmtsarigul commented 6 years ago

Dear Stuart;

Thanks for your quick reply. I just realized that the error is caused by a module that I wrote. I have overwritten the parameters() method in a wrong way so this method does not return a table value as it must do. It causes the problem.

Thank you.