diff options
author | diz_vara <avarfolomeev@navmii.com> | 2015-04-23 16:46:50 +0300 |
---|---|---|
committer | diz_vara <avarfolomeev@navmii.com> | 2015-04-23 16:46:50 +0300 |
commit | ca0a7cd0fcccace9ba4841df67683aa24924e74e (patch) | |
tree | 987110da06ffff72a1bdc76ebeef213fe44f631e /Sequential.lua | |
parent | 394554a8440725e5fd53664fbff675ee567d0fae (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.lua | 4 |
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 |