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

github.com/clementfarabet/lua---nnx.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorClement Farabet <clement.farabet@gmail.com>2012-03-13 01:04:59 +0400
committerClement Farabet <clement.farabet@gmail.com>2012-03-13 01:04:59 +0400
commit9e800b3021f3736a0239476c248e3ff5b5040cc7 (patch)
treec2553136db21c21df43758841d0a202b1cc8df87 /SpatialMatching.lua
parentb8d8c0b682eb146453fda721907a58dae4cb9335 (diff)
Some detials in spatial matching.
Diffstat (limited to 'SpatialMatching.lua')
-rw-r--r--SpatialMatching.lua13
1 files changed, 8 insertions, 5 deletions
diff --git a/SpatialMatching.lua b/SpatialMatching.lua
index 77632e3..7de6264 100644
--- a/SpatialMatching.lua
+++ b/SpatialMatching.lua
@@ -11,8 +11,12 @@ function SpatialMatching:__init(maxw, maxh, full_output)
parent.__init(self)
self.maxw = maxw or 11
self.maxh = maxh or 11
- full_output = full_output or true
- if full_output then self.full_output = 1 else self.full_output = 0 end
+ if full_output == nil then
+ full_output = false
+ end
+ self.full_output = full_output
+ self.gradInput1 = torch.Tensor()
+ self.gradInput2 = torch.Tensor()
end
function SpatialMatching:updateOutput(input)
@@ -24,9 +28,8 @@ function SpatialMatching:updateOutput(input)
end
function SpatialMatching:updateGradInput(input, gradOutput)
- -- TODO this is probably the wrong way
- self.gradInput1 = torch.Tensor(input[1]:size()):zero()
- self.gradInput2 = torch.Tensor(input[2]:size()):zero()
+ self.gradInput1:resize(input[1]:size()):zero()
+ self.gradInput2:resize(input[2]:size()):zero()
input[1].nn.SpatialMatching_updateGradInput(self, input[1], input[2], gradOutput)
self.gradInput = {self.gradInput1, self.gradInput2}
return self.gradInput