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:
authordiz_vara <avarfolomeev@navmii.com>2015-04-23 16:46:50 +0300
committerdiz_vara <avarfolomeev@navmii.com>2015-04-23 16:46:50 +0300
commitca0a7cd0fcccace9ba4841df67683aa24924e74e (patch)
tree987110da06ffff72a1bdc76ebeef213fe44f631e /Sequential.lua
parent394554a8440725e5fd53664fbff675ee567d0fae (diff)
Sequential:__len() operator added
now nn.Sequential will support # operator - and who() will not crash
Diffstat (limited to 'Sequential.lua')
-rw-r--r--Sequential.lua4
1 files changed, 4 insertions, 0 deletions
diff --git a/Sequential.lua b/Sequential.lua
index 3288e6d..5145727 100644
--- a/Sequential.lua
+++ b/Sequential.lua
@@ -1,5 +1,9 @@
local Sequential, _ = torch.class('nn.Sequential', 'nn.Container')
+function Sequential:__len()
+ return #self.modules
+end
+
function Sequential:add(module)
if #self.modules == 0 then
self.gradInput = module.gradInput