diff options
author | Soumith Chintala <soumith@gmail.com> | 2016-06-29 21:43:12 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2016-06-29 21:43:12 +0300 |
commit | aa7afe930690e2be6779650af0a1473716a93949 (patch) | |
tree | a5ff1ce0d3647eb424820b00ef95a252219dc228 | |
parent | 09de630062b6d55688d5958d96f6d6d069474899 (diff) | |
parent | fdef3826f243192e98a462208f7df06d07267290 (diff) |
Merge pull request #213 from ngimel/master
workaround for :resize() issue
-rw-r--r-- | RNN.lua | 8 |
1 files changed, 7 insertions, 1 deletions
@@ -276,7 +276,13 @@ function RNN:updateOutput(input) end local x = self:makeContiguous(input) - local y = self:resizeOutput(self.output) + local oSize = torch.LongStorage({self.seqLength, self.miniBatch, self.hiddenSize * self.numDirections}) + if not self.output:isContiguous() then + self.output = self.output:transpose(1,2) + assert(self.output:isContiguous()) + end + self.output:resize(oSize) + local y = self.output local w = self.weight local hy = self:resizeHidden(self.hiddenOutput):zero() local cy = self:resizeHidden(self.cellOutput):zero() |