X-Git-Url: https://www.fleuret.org/cgi-bin/gitweb/gitweb.cgi?p=dagnn.git;a=blobdiff_plain;f=dagnn.lua;h=67e113d84300cdefd43ab799d77d46a946e21e13;hp=5921c05da410a041186e8cd8806046b4673fd027;hb=7dc69291661dbdf731f0da2955e8fec5f288cbba;hpb=84b07c45eb8a2785a81cad7bcf6fadbac0d63f8f diff --git a/dagnn.lua b/dagnn.lua index 5921c05..67e113d 100755 --- a/dagnn.lua +++ b/dagnn.lua @@ -76,6 +76,10 @@ function DAG:putInOrder() end until nc == 0 + for _, nnm in pairs(self.modules) do + assert(distance[nnm], 'Some modules are not connected to inputs') + end + self.sorted = {} for m, d in pairs(distance) do table.insert(self.sorted, { distance = d, nnm = m }) @@ -143,7 +147,7 @@ function DAG:setInput(i) self:nestedApply( function(nnm) if #self.node[nnm].succ == 0 then - error('Input modules must have outgoing edges.') + error('Input modules must have outgoing edges.') end if #self.node[nnm].pred > 0 then error('Input modules cannot have incoming edges.')