diff options
author | Soumith Chintala <soumith@gmail.com> | 2015-07-28 20:54:46 +0300 |
---|---|---|
committer | Soumith Chintala <soumith@gmail.com> | 2015-07-28 20:54:46 +0300 |
commit | 85e9542cf2051c3ebb07984ccb439f075b36da67 (patch) | |
tree | 5a6d3176a41d8a512c19494e55bb03aca0183604 | |
parent | 0c2416f347159248048537d8540cc53429d742b0 (diff) | |
parent | 7d7deb228c100360e269b985f64168a5d4e5cdda (diff) |
Merge pull request #334 from torch/selecttablefix
Fix SelectTable variable input size bug
-rw-r--r-- | SelectTable.lua | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/SelectTable.lua b/SelectTable.lua index 61918f7..12dc718 100644 --- a/SelectTable.lua +++ b/SelectTable.lua @@ -13,7 +13,7 @@ function SelectTable:updateOutput(input) else self.output = input[self.index] end - + return self.output end @@ -43,6 +43,11 @@ function SelectTable:updateGradInput(input, gradOutput) self.gradInput[self.index] = gradOutput end zeroTableCopy(self.gradInput, input) + + for i=#input+1, #self.gradInput do + self.gradInput[i] = nil + end + return self.gradInput end |