{"action":"created","issue":{"url":"https://api.github.com/repos/torch/nn/issues/640","repository_url":"https://api.github.com/repos/torch/nn","labels_url":"https://api.github.com/repos/torch/nn/issues/640/labels{/name}","comments_url":"https://api.github.com/repos/torch/nn/issues/640/comments","events_url":"https://api.github.com/repos/torch/nn/issues/640/events","html_url":"https://github.com/torch/nn/issues/640","id":134371071,"number":640,"title":"Problem backpropagating from LookupTable to JoinTable","user":{"login":"boknilev","id":3613289,"avatar_url":"https://avatars.githubusercontent.com/u/3613289?v=3","gravatar_id":"","url":"https://api.github.com/users/boknilev","html_url":"https://github.com/boknilev","followers_url":"https://api.github.com/users/boknilev/followers","following_url":"https://api.github.com/users/boknilev/following{/other_user}","gists_url":"https://api.github.com/users/boknilev/gists{/gist_id}","starred_url":"https://api.github.com/users/boknilev/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/boknilev/subscriptions","organizations_url":"https://api.github.com/users/boknilev/orgs","repos_url":"https://api.github.com/users/boknilev/repos","events_url":"https://api.github.com/users/boknilev/events{/privacy}","received_events_url":"https://api.github.com/users/boknilev/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":6,"created_at":"2016-02-17T19:11:03Z","updated_at":"2016-02-22T18:35:06Z","closed_at":null,"body":"There seems to be a problem when trying to backpropagate from nn.LookupTable to nn.JoinTable. Here's a minimal working example:\r\n\r\n```lua\r\nmodel = nn.Sequential()\r\nmodel:add(nn.JoinTable(1))\r\nmodel:add(nn.LookupTable(10,2))\r\ninput = {torch.Tensor{1,2,3}, torch.Tensor{4,5,6}}\r\nout = model:forward(input)\r\nmodel:backward(input, out)\r\n```\r\n\r\nThis fails with the following error:\r\n```\r\n/path/to/JoinTable.lua:59: bad argument #1 to 'narrow' (out of range at path/to/torch/pkg/torch/lib/TH/generic/THTensor.c:349)\r\n```\r\n\r\nThe problem seems to be coming from LookupTable:updateGradInput returning a torch.DoubleTensor with no dimension. Then JoinTable:updateGradInput is failing when trying to do narrow on this no  tensor with no dimension.\r\n\r\nAny ideas what might be going on?\r\n\r\nI'm getting this on Ubuntu 14.04 with an nn version that I just updated today."},"comment":{"url":"https://api.github.com/repos/torch/nn/issues/comments/187309614","html_url":"https://github.com/torch/nn/issues/640#issuecomment-187309614","issue_url":"https://api.github.com/repos/torch/nn/issues/640","id":187309614,"user":{"login":"kbullaughey","id":613650,"avatar_url":"https://avatars.githubusercontent.com/u/613650?v=3","gravatar_id":"","url":"https://api.github.com/users/kbullaughey","html_url":"https://github.com/kbullaughey","followers_url":"https://api.github.com/users/kbullaughey/followers","following_url":"https://api.github.com/users/kbullaughey/following{/other_user}","gists_url":"https://api.github.com/users/kbullaughey/gists{/gist_id}","starred_url":"https://api.github.com/users/kbullaughey/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kbullaughey/subscriptions","organizations_url":"https://api.github.com/users/kbullaughey/orgs","repos_url":"https://api.github.com/users/kbullaughey/repos","events_url":"https://api.github.com/users/kbullaughey/events{/privacy}","received_events_url":"https://api.github.com/users/kbullaughey/received_events","type":"User","site_admin":false},"created_at":"2016-02-22T18:35:06Z","updated_at":"2016-02-22T18:35:06Z","body":"Hm...that works. Seems a bit hacky though. I wonder if this should be the standard behavior when updateGradInput receives a dimensionless gradient during backpropagation? Or does it make more sense to handle it on a case-by-case basis, depending on network topology?"}}