From: Francois Fleuret Date: Fri, 13 Jan 2017 08:08:55 +0000 (+0100) Subject: Now prints the input index when a node gets multiple input. X-Git-Url: https://fleuret.org/cgi-bin/gitweb/gitweb.cgi?a=commitdiff_plain;h=0b9befca4f43c39e01801efc417069ef709b9271;p=dagnn.git Now prints the input index when a node gets multiple input. --- diff --git a/dagnn.lua b/dagnn.lua index ca51841..c17347d 100755 --- a/dagnn.lua +++ b/dagnn.lua @@ -167,20 +167,25 @@ function DAG:saveDot(filename) file:write('\n') - for nnma, node in pairs(self.node) do + for nnmb, node in pairs(self.node) do file:write( ' ' .. node.index - .. ' [shape=box,label=\"' .. torch.type(nnma) .. '\"]' + .. ' [shape=box,label=\"' .. torch.type(nnmb) .. '\"]' .. '\n' ) - for _, nnmb in pairs(node.succ) do + for i, nnma in pairs(node.pred) do + local decoration = '' + if #node.pred > 1 then + decoration = ' [label=\"' .. i .. '\"]' + end file:write( ' ' - .. node.index + .. self.node[nnma].index .. ' -> ' .. self.node[nnmb].index + .. decoration .. '\n' ) end