diff options
author | etg <etg@google.com> | 2015-02-24 00:31:04 +0300 |
---|---|---|
committer | etg <etg@google.com> | 2015-02-24 00:31:04 +0300 |
commit | 99e7d5e5f83cd678eb5901ef167e9b29c1cbe9fc (patch) | |
tree | 55393ac71210a983ed7553515cd91e03f7b3194d | |
parent | 3b97d427f11204b5d32e19f53ea9cdd04cc6af6b (diff) |
This makes gModules behave consistently with nn.Modules and nn.Container, and solves the issues of trying to change the behaviour of layers like nn.Dropout which may be in nested gModules.
-rw-r--r-- | gmodule.lua | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/gmodule.lua b/gmodule.lua index c9f669b..e69e79f 100644 --- a/gmodule.lua +++ b/gmodule.lua @@ -113,6 +113,14 @@ function gModule:apply(func) end end +function gModule:training() + self:apply(function(module) module:training() end) +end + +function gModule:evaluate() + self:apply(function(module) module:evaluate() end) +end + function gModule:type(type) self:apply(function(module) module:type(type) end) return self |