From: Francois Fleuret Date: Wed, 11 Jan 2017 08:32:22 +0000 (+0100) Subject: Update. X-Git-Url: https://fleuret.org/cgi-bin/gitweb/gitweb.cgi?a=commitdiff_plain;h=60568def49e4c624e54f53b4be5783d6cfbe1ea9;p=dagnn.git Update. --- diff --git a/dagnn.lua b/dagnn.lua index a6414b3..2ed25c5 100755 --- a/dagnn.lua +++ b/dagnn.lua @@ -46,8 +46,11 @@ function DAG:setInput(i) self.inputModules = i self:applyOnModules( function(m) - if (not self.succ[m] or #self.succ[m] == 0) or (self.pred[m] and #self.pred[m] > 0) then - error('Invalid input edges.') + if not self.succ[m] or #self.succ[m] == 0 then + error('Input modules must have outgoing edges.') + end + if self.pred[m] and #self.pred[m] > 0 then + error('Input modules cannog have incoming edges.') end end, self.inputModules @@ -59,8 +62,11 @@ function DAG:setOutput(o) self.outputModules = o self:applyOnModules( function(m) - if (not self.pred[m] or #self.pred[m] == 0) or (self.succ[m] and #self.succ[m] > 0) then - error('Invalid output edges.') + if not self.pred[m] or #self.pred[m] == 0 then + error('Output module must have incoming edges.') + end + if self.succ[m] and #self.succ[m] > 0 then + error('Output module cannot have outgoing edges.') end end, self.outputModules diff --git a/test-dagnn.lua b/test-dagnn.lua index 6c09f95..3b1e66a 100755 --- a/test-dagnn.lua +++ b/test-dagnn.lua @@ -43,7 +43,7 @@ g:addEdge(b, d) g:addEdge(d, f) g:setInput({a}) -g:setOutput({e,f}) +g:setOutput({e, f}) g:print()