Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/torch/nn.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorsoumith <soumith@fb.com>2015-07-28 20:53:00 +0300
committersoumith <soumith@fb.com>2015-07-28 20:53:00 +0300
commit7d7deb228c100360e269b985f64168a5d4e5cdda (patch)
tree5a6d3176a41d8a512c19494e55bb03aca0183604
parent841227a5dd30d407c254941dd36c5ec17bd83daf (diff)
Fix SelectTable variable input size bug
-rw-r--r--SelectTable.lua7
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