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:
authorAdam Paszke <adam.paszke@gmail.com>2016-03-15 03:09:24 +0300
committerAdam Paszke <adam.paszke@gmail.com>2016-03-15 03:10:38 +0300
commite59de3fd55381943961d6c3ff57c8060ee920d1f (patch)
treea1bb495d0b04b967f9a08ed7badada5b29b97e8d /View.lua
parent0f78da5b75bda357f780f1808e28e8333a8bcdb8 (diff)
Fix backward-compatibility of nn.View
Diffstat (limited to 'View.lua')
-rw-r--r--View.lua2
1 files changed, 2 insertions, 0 deletions
diff --git a/View.lua b/View.lua
index 8a1c6ac..542e57e 100644
--- a/View.lua
+++ b/View.lua
@@ -75,6 +75,7 @@ local function batchsize(input, size, numInputDims, numElements)
end
function View:updateOutput(input)
+ self.output = self.output or input.new()
local bsz = batchsize(input, self.size, self.numInputDims, self.numElements)
if bsz then
self.output:view(input, bsz, table.unpack(self.size:totable()))
@@ -85,6 +86,7 @@ function View:updateOutput(input)
end
function View:updateGradInput(input, gradOutput)
+ self.gradInput = self.gradInput or gradOutput.new()
self.gradInput:view(gradOutput, input:size())
return self.gradInput
end