diff options
Diffstat (limited to 'init.lua')
-rw-r--r-- | init.lua | 14 |
1 files changed, 11 insertions, 3 deletions
@@ -27,16 +27,24 @@ function Module:__call__(...) local input = ... if nArgs == 1 and input == nil then - error('what is this in the input? nil') + error(utils.expectingNodeErrorMessage(input, 'inputs', 1)) + end + -- Disallow passing empty table, in case someone passes a table with some + -- typo'd variable name in. + if type(input) == 'table' and next(input) == nil then + error('cannot pass an empty table of inputs. To indicate no incoming ' .. + 'connections, leave the second set of parens blank.') end if not istable(input) then input = {input} end local mnode = nngraph.Node({module=self}) - for i,dnode in ipairs(input) do + local dnode + for i = 1, utils.tableMaxN(input) do + dnode = input[i] if torch.typename(dnode) ~= 'nngraph.Node' then - error('what is this in the input? ' .. tostring(dnode)) + error(utils.expectingNodeErrorMessage(dnode, 'inputs', i)) end mnode:add(dnode,true) end |