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:
authorkoray kavukcuoglu <koray@kavukcuoglu.org>2012-07-30 22:28:56 +0400
committerkoray kavukcuoglu <koray@kavukcuoglu.org>2012-07-30 22:28:56 +0400
commit03bd1d7df6ddc482e728a7d0a5fcfb843b991275 (patch)
treefdf3dd0d847db485d04459f1a77d8884bc843a9b
parent0d9a4a50c9253b032a41ad114c41aa82d370d102 (diff)
Update extra/nn/Sum.lua
make sure that self.output is a tensor
-rw-r--r--Sum.lua3
1 files changed, 3 insertions, 0 deletions
diff --git a/Sum.lua b/Sum.lua
index b068e25..fa22309 100644
--- a/Sum.lua
+++ b/Sum.lua
@@ -7,6 +7,9 @@ function Sum:__init(dimension)
end
function Sum:updateOutput(input)
+ if type(self.output) == 'number' then
+ self.output = input.new()
+ end
input.torch.sum(self.output, input, self.dimension)
self.output = self.output:select(self.dimension, 1)
return self.output