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:
Diffstat (limited to 'PairwiseDistance.lua')
-rw-r--r--PairwiseDistance.lua4
1 files changed, 4 insertions, 0 deletions
diff --git a/PairwiseDistance.lua b/PairwiseDistance.lua
index d9e6f81..1752a88 100644
--- a/PairwiseDistance.lua
+++ b/PairwiseDistance.lua
@@ -20,6 +20,10 @@ function PairwiseDistance:updateOutput(input)
--local diff = torch.add(input[1], -1, input[2])
diff:add(input[1], -1, input[2])
+ if math.mod(self.norm, 2) == 1 then
+ diff:abs()
+ end
+
self.output:resize(input[1]:size(1))
self.output:zero()
self.output:add(diff:pow(self.norm):sum(2))