diff options
author | koray kavukcuoglu <koray@kavukcuoglu.org> | 2013-04-16 01:24:40 +0400 |
---|---|---|
committer | koray kavukcuoglu <koray@kavukcuoglu.org> | 2013-04-16 01:24:40 +0400 |
commit | cf6587c60c6d393119cf4c485aff8c735a374492 (patch) | |
tree | e057b57f62413b103bd88cba93e54be882ae1bc6 | |
parent | d9cacd885147791446538c7786ccb41387c64d63 (diff) |
CMul should resize the gradInput into the same shape as input.
-rw-r--r-- | CMul.lua | 3 |
1 files changed, 2 insertions, 1 deletions
@@ -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 |