{"action":"opened","issue":{"url":"https://api.github.com/repos/Element-Research/rnn/issues/357","repository_url":"https://api.github.com/repos/Element-Research/rnn","labels_url":"https://api.github.com/repos/Element-Research/rnn/issues/357/labels{/name}","comments_url":"https://api.github.com/repos/Element-Research/rnn/issues/357/comments","events_url":"https://api.github.com/repos/Element-Research/rnn/issues/357/events","html_url":"https://github.com/Element-Research/rnn/issues/357","id":184634784,"number":357,"title":"getParameters() throwing error on Pre-trained Cloned Model","user":{"login":"nakulagarwal94","id":13354708,"avatar_url":"https://avatars.githubusercontent.com/u/13354708?v=3","gravatar_id":"","url":"https://api.github.com/users/nakulagarwal94","html_url":"https://github.com/nakulagarwal94","followers_url":"https://api.github.com/users/nakulagarwal94/followers","following_url":"https://api.github.com/users/nakulagarwal94/following{/other_user}","gists_url":"https://api.github.com/users/nakulagarwal94/gists{/gist_id}","starred_url":"https://api.github.com/users/nakulagarwal94/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nakulagarwal94/subscriptions","organizations_url":"https://api.github.com/users/nakulagarwal94/orgs","repos_url":"https://api.github.com/users/nakulagarwal94/repos","events_url":"https://api.github.com/users/nakulagarwal94/events{/privacy}","received_events_url":"https://api.github.com/users/nakulagarwal94/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2016-10-22T14:56:48Z","updated_at":"2016-10-22T14:56:48Z","closed_at":null,"body":"Hi,\r\n\r\nI have a simple `LSTM` architecture as shown below :\r\n\r\n```lua\r\nnn.Sequential {\r\n  [input -> (1) -> output]\r\n  (1): nn.Sequential {\r\n    [input -> (1) -> output]\r\n    (1): nn.Sequencer @ nn.Recursor @ nn.Sequential {\r\n      [input -> (1) -> output]\r\n      (1): nn.LSTM(5000 -> 512)\r\n    }\r\n  }\r\n}\r\n```\r\nNow I have pre-trained this already and saved it. Next I load the model and perform a `clone()` on it as:\r\n\r\n```lua\r\nmodel = torch.load('model.net')\r\nmodel_cloned = model:clone('weight', 'bias')\r\n```\r\n\r\nIf I perform `getParameters()` on the original model, it gets executed as expected. But if I want to do the same on the *cloned* model, it throws an error.\r\n\r\n```lua\r\nth> param, gradparam = model:getParameters()     -- works fine !\r\n\r\nth> param2, gradparam2 = model_cloned:getParameters()  -- gives error !\r\n```\r\nIt gives the following error :\r\n\r\n```\r\n/torch/install/share/lua/5.1/nn/Module.lua:244: Torch object, table, thread, cdata or function expected\r\nstack traceback:\r\n\t[C]: in function 'pointer'\r\n\ttorch/install/share/lua/5.1/nn/Module.lua:244: in function 'flatten'\r\n\ttorch/install/share/lua/5.1/dpnn/Module.lua:215: in function 'getParameters'\r\n\t[string \"param2, gradparam2 = model2:getParameters()\"]:1: in main chunk\r\n\t[C]: in function 'xpcall'\r\n\ttorch/install/share/lua/5.1/trepl/init.lua:670: in function 'repl'\r\n\ttorch/install/lib/luarocks/rocks/trepl/scm-1/bin/th:199: in main chunk\r\n\t[C]: at 0x00406670\r\n```\r\n\r\nAny idea regarding why this is happening ?\r\n\r\nThanks in advance !"}}
{"actor":{"display_login":"nakulagarwal94"}}