diff options
author | Soumith Chintala <soumith@gmail.com> | 2015-06-10 16:53:25 +0300 |
---|---|---|
committer | Soumith Chintala <soumith@gmail.com> | 2015-06-10 16:53:25 +0300 |
commit | affc6e066025ad5d5f4a75e41cf37bf9b84c6f04 (patch) | |
tree | 5db23602a1d269fde10c9c53b8e0515dd91defbd | |
parent | e35677a870e89d6c0e2a099c877c43247bd8a72d (diff) | |
parent | 70564a1e6e8dcdc7c94f2927e8601cfabda5484d (diff) |
Merge pull request #53 from zhangxiangxiao/master
Added share function for gModule
-rw-r--r-- | gmodule.lua | 9 |
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 |