projects
/
dagnn.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
84b07c4
)
Added a check that all nodes are connected to the inputs.
author
Francois Fleuret
<francois@fleuret.org>
Sat, 14 Jan 2017 21:12:32 +0000
(22:12 +0100)
committer
Francois Fleuret
<francois@fleuret.org>
Sat, 14 Jan 2017 21:12:32 +0000
(22:12 +0100)
dagnn.lua
patch
|
blob
|
history
diff --git
a/dagnn.lua
b/dagnn.lua
index
5921c05
..
67e113d
100755
(executable)
--- a/
dagnn.lua
+++ b/
dagnn.lua
@@
-76,6
+76,10
@@
function DAG:putInOrder()
end
until nc == 0
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 })
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
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.')
end
if #self.node[nnm].pred > 0 then
error('Input modules cannot have incoming edges.')