diff options
author | Sergey Zagoruyko <zagoruyko2@gmail.com> | 2016-02-08 03:22:07 +0300 |
---|---|---|
committer | Sergey Zagoruyko <zagoruyko2@gmail.com> | 2016-02-09 21:42:51 +0300 |
commit | 4696a46212ffc5bb54b0d8f3327dfa47693bbfdf (patch) | |
tree | 5f4512a8ead3d952d17a9a82c200a60ba6cb5082 /WeightedMSECriterion.lua | |
parent | 948ac6a26cc6c2812e04718911bca9a4b641020e (diff) |
lazy init
Diffstat (limited to 'WeightedMSECriterion.lua')
-rw-r--r-- | WeightedMSECriterion.lua | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/WeightedMSECriterion.lua b/WeightedMSECriterion.lua index 274cb32..9334729 100644 --- a/WeightedMSECriterion.lua +++ b/WeightedMSECriterion.lua @@ -3,10 +3,10 @@ local WeightedMSECriterion, parent = torch.class('nn.WeightedMSECriterion','nn.M function WeightedMSECriterion:__init(w) parent.__init(self) self.weight = w:clone() - self.buffer = torch.Tensor() end function WeightedMSECriterion:updateOutput(input,target) + self.buffer = self.buffer or input.new() self.buffer:resizeAs(input):copy(target) if input:dim() - 1 == self.weight:dim() then for i=1,input:size(1) do |