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

github.com/soumith/cudnn.torch.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGreg Heinrich <gheinrich@nvidia.com>2016-03-25 17:14:13 +0300
committerGreg Heinrich <gheinrich@nvidia.com>2016-03-25 23:00:24 +0300
commit02bc67c446d0c42b7831a83ba15bff9677a372d2 (patch)
tree64d91f02d33f955526e05a05815949826e53f72c /TemporalConvolution.lua
parent7e74cb7464106114b468289f5dcc59744b2d25cd (diff)
Fix TemporalConvolution output size
Issue seen in updateOutput() when batch size is decreasing (e.g. 256->128): ``` .../torch/install/share/lua/5.1/torch/Tensor.lua:462: Wrong size for view. Input size: 66060288. Output size: 128x256x1008x1 stack traceback: [C]: in function 'error' .../torch/install/share/lua/5.1/torch/Tensor.lua:462: in function 'view' ...orch/install/share/lua/5.1/cudnn/TemporalConvolution.lua:62: in function <...orch/install/share/lua/5.1/cudnn/TemporalConvolution.lua:54> ``` See new test cudnntest.TemporalConvolution_reduceBatchSize() for a repro. Calling a tensor's set() method without extra parameters but the requested storage causes the tensor to see a 1-D view of the full storage (not the associated tensor). For example: ``` th> x=torch.Tensor(10) [0.0001s] th> y=x:resize(5) [0.0001s] th> torch.Tensor():set(y:storage()):size() 10 [torch.LongStorage of size 1] [0.0002s] ``` Proposed fix is to specify the desired view through the optional parameters of the set() method.
Diffstat (limited to 'TemporalConvolution.lua')
-rw-r--r--TemporalConvolution.lua2
1 files changed, 1 insertions, 1 deletions
diff --git a/TemporalConvolution.lua b/TemporalConvolution.lua
index f59a5bd..a9e6470 100644
--- a/TemporalConvolution.lua
+++ b/TemporalConvolution.lua
@@ -57,7 +57,7 @@ function TemporalConvolution:updateOutput(input)
self.buffer = self.buffer or torch.CudaTensor()
self._output = self._output or torch.CudaTensor()
if self.output:storage() then self._output:set(self.output:storage()) else self._output = self.output end
- if self.buffer:storage() then self.output:set(self.buffer:storage()) else self.output = self.buffer end
+ if self.buffer:storage() then self.output:set(self.buffer:storage(), 1, self.output:size()) else self.output = self.buffer end
cudnn.SpatialConvolution.updateOutput(self,_input)
self.buffer = self.output:view(self.oSize):transpose(2,3)
self.output = self._output:resize(self.buffer:size()):copy(self.buffer)