{"action":"closed","issue":{"url":"https://api.github.com/repos/jihunchoi/recurrent-batch-normalization-pytorch/issues/6","repository_url":"https://api.github.com/repos/jihunchoi/recurrent-batch-normalization-pytorch","labels_url":"https://api.github.com/repos/jihunchoi/recurrent-batch-normalization-pytorch/issues/6/labels{/name}","comments_url":"https://api.github.com/repos/jihunchoi/recurrent-batch-normalization-pytorch/issues/6/comments","events_url":"https://api.github.com/repos/jihunchoi/recurrent-batch-normalization-pytorch/issues/6/events","html_url":"https://github.com/jihunchoi/recurrent-batch-normalization-pytorch/issues/6","id":287425985,"node_id":"MDU6SXNzdWUyODc0MjU5ODU=","number":6,"title":"Size mismatch when using bnlstm and layer>1 - solution","user":{"login":"danarte","id":11928608,"node_id":"MDQ6VXNlcjExOTI4NjA4","avatar_url":"https://avatars1.githubusercontent.com/u/11928608?v=4","gravatar_id":"","url":"https://api.github.com/users/danarte","html_url":"https://github.com/danarte","followers_url":"https://api.github.com/users/danarte/followers","following_url":"https://api.github.com/users/danarte/following{/other_user}","gists_url":"https://api.github.com/users/danarte/gists{/gist_id}","starred_url":"https://api.github.com/users/danarte/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/danarte/subscriptions","organizations_url":"https://api.github.com/users/danarte/orgs","repos_url":"https://api.github.com/users/danarte/repos","events_url":"https://api.github.com/users/danarte/events{/privacy}","received_events_url":"https://api.github.com/users/danarte/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":1,"created_at":"2018-01-10T13:03:12Z","updated_at":"2018-10-03T12:47:24Z","closed_at":"2018-10-03T12:47:24Z","author_association":"NONE","body":"Hello,\r\nI was using your implementation for my project and have encountered a size mismatch error when using bnlstm and 2 layers.\r\n\r\nThe mismatch happens because  the second layer is initiated with \"input size\" parameter of \"hidden-size\"  (You can see it here: [https://github.com/jihunchoi/recurrent-batch-normalization-pytorch/blob/master/bnlstm.py#L237](https://github.com/jihunchoi/recurrent-batch-normalization-pytorch/blob/master/bnlstm.py#L237)) but the forward function still passes the regular input which is of size \"input size\" (you can see this here: [https://github.com/jihunchoi/recurrent-batch-normalization-pytorch/blob/master/bnlstm.py#L288](https://github.com/jihunchoi/recurrent-batch-normalization-pytorch/blob/master/bnlstm.py#L288))\r\nSo at this line of code: [https://github.com/jihunchoi/recurrent-batch-normalization-pytorch/blob/master/bnlstm.py#L211](https://github.com/jihunchoi/recurrent-batch-normalization-pytorch/blob/master/bnlstm.py#L211)\r\nThe input_ variable is of size (input_size * something) but the second layer expects input_ variable to be of size (hidden * something).\r\n\r\nTo solve this issue I changed lines 288-289 to this:\r\n```\r\n            if layer == 0:\r\n                layer_output, (layer_h_n, layer_c_n) = LSTM._forward_rnn(\r\n                    cell=cell, input_=input_, length=length, hx=hx)\r\n            else:\r\n                layer_output, (layer_h_n, layer_c_n) = LSTM._forward_rnn(\r\n                    cell=cell, input_=layer_output, length=length, hx=hx)\r\n```\r\n\r\nThanks for the publishing the implementation.\r\nYou can close this issue when/if you wish.\r\n\r\nP.s: By the way, I would appreciate if you could find a possible solution to the other open issue about reset_parameters, or maybe we could say that the reset_parameters does not affect the network too much so we can just make it default and forget it."}}
{"actor":{"display_login":"jihunchoi"}}