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

github.com/torch/nngraph.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSoumith Chintala <soumith@gmail.com>2015-06-10 16:53:25 +0300
committerSoumith Chintala <soumith@gmail.com>2015-06-10 16:53:25 +0300
commitaffc6e066025ad5d5f4a75e41cf37bf9b84c6f04 (patch)
tree5db23602a1d269fde10c9c53b8e0515dd91defbd
parente35677a870e89d6c0e2a099c877c43247bd8a72d (diff)
parent70564a1e6e8dcdc7c94f2927e8601cfabda5484d (diff)
Merge pull request #53 from zhangxiangxiao/master
Added share function for gModule
-rw-r--r--gmodule.lua9
1 files changed, 9 insertions, 0 deletions
diff --git a/gmodule.lua b/gmodule.lua
index e6e5fab..3021855 100644
--- a/gmodule.lua
+++ b/gmodule.lua
@@ -363,6 +363,15 @@ function gModule:parameters()
return p,gp
end
+-- Added share function
+function gModule:share(gModuleToShare, ...)
+ for indexNode, node in ipairs(self.forwardnodes) do
+ if node.data.module then
+ node.data.module:share(gModuleToShare.forwardnodes[indexNode].data.module, ...)
+ end
+ end
+end
+
function gModule:__tostring__()
return self.name or torch.type(self)
end