Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/torch/nn.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSergey Zagoruyko <zagoruyko2@gmail.com>2016-02-04 17:53:04 +0300
committerSergey Zagoruyko <zagoruyko2@gmail.com>2016-02-09 21:08:41 +0300
commitb4ebdf2f95ee9f1429825a0d7b0948721e407d82 (patch)
tree77b6183d0c258d07d5f5e6338c48ccb5fc5a877b /PairwiseDistance.lua
parent4a433463fcd17c4ec3242586da7e9fc859feb3ae (diff)
nn.clearState
Diffstat (limited to 'PairwiseDistance.lua')
-rw-r--r--PairwiseDistance.lua6
1 files changed, 6 insertions, 0 deletions
diff --git a/PairwiseDistance.lua b/PairwiseDistance.lua
index c7dc096..d5022a7 100644
--- a/PairwiseDistance.lua
+++ b/PairwiseDistance.lua
@@ -10,6 +10,7 @@ function PairwiseDistance:__init(p)
end
function PairwiseDistance:updateOutput(input)
+ self.output:resize(1)
if input[1]:dim() == 1 then
self.output:resize(1)
self.output[1]=input[1]:dist(input[2],self.norm)
@@ -83,3 +84,8 @@ function PairwiseDistance:updateGradInput(input, gradOutput)
self.gradInput[2]:zero():add(-1, self.gradInput[1])
return self.gradInput
end
+
+function PairwiseDistance:clearState()
+ nn.utils.clear(self, 'diff', 'outExpand', 'grad', 'ones')
+ return parent.clearState(self)
+end