From cf6587c60c6d393119cf4c485aff8c735a374492 Mon Sep 17 00:00:00 2001 From: koray kavukcuoglu Date: Mon, 15 Apr 2013 22:24:40 +0100 Subject: CMul should resize the gradInput into the same shape as input. --- CMul.lua | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/CMul.lua b/CMul.lua index 9b59944..317365b 100644 --- a/CMul.lua +++ b/CMul.lua @@ -7,7 +7,7 @@ function CMul:__init(inputSize) self.gradWeight = torch.Tensor(inputSize) -- state - self.gradInput:resize(inputSize) + -- self.gradInput:resize(inputSize) self.output:resize(inputSize) self:reset() @@ -25,6 +25,7 @@ end function CMul:updateGradInput(input, gradOutput) if self.gradInput then + self.gradInput:resizeAs(input) self.gradInput:zero() self.gradInput:addcmul(1, self.weight, gradOutput) return self.gradInput -- cgit v1.2.3