diff options
author | Luke Hewitt <insperatum@gmail.com> | 2015-11-16 04:02:45 +0300 |
---|---|---|
committer | Luke Hewitt <insperatum@gmail.com> | 2015-11-16 04:02:45 +0300 |
commit | b1ec1c1ddade74f06fe610ed589f9cfefdf22763 (patch) | |
tree | 3da119cb87cca23df1bdb2803b107bbf756518d7 /Identity.lua | |
parent | 402513b540305e4789d8d80feb0c262c82a449af (diff) |
State variable pointers should never change.
see: https://github.com/torch/nn/blob/master/doc/module.md#state-variables
Diffstat (limited to 'Identity.lua')
-rw-r--r-- | Identity.lua | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/Identity.lua b/Identity.lua index 088cc34..18a3c9b 100644 --- a/Identity.lua +++ b/Identity.lua @@ -1,12 +1,12 @@ local Identity, _ = torch.class('nn.Identity', 'nn.Module') function Identity:updateOutput(input) - self.output = input + self.output:set(input:storage(), input:storageOffset(), input:size(), input:stride()) return self.output end function Identity:updateGradInput(input, gradOutput) - self.gradInput = gradOutput + self.gradInput:set(gradOutput:storage(), gradOutput:storageOffset(), gradOutput:size(), gradOutput:stride()) return self.gradInput end |