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:
authorDominik Grewe <dominikg@google.com>2015-04-28 18:07:32 +0300
committerDominik Grewe <dominikg@google.com>2015-04-28 18:36:55 +0300
commitd0da63e83825d4631a7f299766a1fa968eb5ccd3 (patch)
treeedab79c4cf664ef0dac24fb851923059027e659e /PairwiseDistance.lua
parent485dd619695c47e49ab56ff518edad52b74475fc (diff)
Make type() truly recursive.
Recursively iterate over the whole table, converting each tensor to the given type. Removes need for many specialized type() functions.
Diffstat (limited to 'PairwiseDistance.lua')
-rw-r--r--PairwiseDistance.lua16
1 files changed, 0 insertions, 16 deletions
diff --git a/PairwiseDistance.lua b/PairwiseDistance.lua
index affc2e5..79569c9 100644
--- a/PairwiseDistance.lua
+++ b/PairwiseDistance.lua
@@ -86,19 +86,3 @@ function PairwiseDistance:updateGradInput(input, gradOutput)
self.gradInput[2]:zero():add(-1, self.gradInput[1])
return self.gradInput
end
-
--- save away Module:type(type) for later use.
-PairwiseDistance._parent_type = parent.type
-
--- Fix the bug where tmp = nn.PairwiseDistance:cuda() fails to convert table
--- contents. We could, and probably should, change Module.lua to loop over
--- and convert all the table elements in a module, but that might have
--- repercussions, so this is a safer solution.
-function PairwiseDistance:type(type)
- self:_parent_type(type) -- Call the parent (Module) type function
- -- Now convert the left over table elements
- self.gradInput[1] = self.gradInput[1]:type(type)
- self.gradInput[2] = self.gradInput[2]:type(type)
- return self
-end
-