diff options
author | Richard Assar <richard@speech-graphics.com> | 2017-03-07 01:46:36 +0300 |
---|---|---|
committer | Richard Assar <richard@speech-graphics.com> | 2017-03-07 01:46:36 +0300 |
commit | 15977951e84621d4109ec0f4b724eff57486e5db (patch) | |
tree | 110fdd8a256a8a1e93b898269b9ed10c2909962d /Contiguous.lua | |
parent | 402a0e3aee0c8e2f62c633d75afab4c744484540 (diff) |
Fix and test case for nn.Contiguous
Diffstat (limited to 'Contiguous.lua')
-rwxr-xr-x[-rw-r--r--] | Contiguous.lua | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/Contiguous.lua b/Contiguous.lua index 2f07e92..f9974ce 100644..100755 --- a/Contiguous.lua +++ b/Contiguous.lua @@ -2,6 +2,7 @@ local Contiguous, parent = torch.class('nn.Contiguous', 'nn.Module') function Contiguous:updateOutput(input) if not input:isContiguous() then + if self.output:storage() == input:storage() then self.output:set() end self.output:resizeAs(input):copy(input) else self.output:set(input) @@ -11,6 +12,7 @@ end function Contiguous:updateGradInput(input, gradOutput) if not gradOutput:isContiguous() then + if self.gradInput:storage() == gradOutput:storage() then self.gradInput:set() end self.gradInput:resizeAs(gradOutput):copy(gradOutput) else self.gradInput:set(gradOutput) |