diff options
author | soumith <soumith@fb.com> | 2015-07-28 20:53:00 +0300 |
---|---|---|
committer | soumith <soumith@fb.com> | 2015-07-28 20:53:00 +0300 |
commit | 7d7deb228c100360e269b985f64168a5d4e5cdda (patch) | |
tree | 5a6d3176a41d8a512c19494e55bb03aca0183604 | |
parent | 841227a5dd30d407c254941dd36c5ec17bd83daf (diff) |
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 |