Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/torch/nngraph.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIvo Danihelka <ivo@danihelka.net>2014-02-12 14:51:57 +0400
committerIvo Danihelka <ivo@danihelka.net>2014-02-12 14:51:57 +0400
commitc6986b72856a0b93e710e6123d52f759ee7f8b96 (patch)
tree015fa13eeb308f7261cb023a5a20042c2881b12b /node.lua
parent36dda4a343822e416fb2ee52fb6396b7d9783c24 (diff)
Displayed the node ids of the input nodes in the mapindex.
Diffstat (limited to 'node.lua')
-rw-r--r--node.lua30
1 files changed, 13 insertions, 17 deletions
diff --git a/node.lua b/node.lua
index ae079fe..51ee300 100644
--- a/node.lua
+++ b/node.lua
@@ -62,32 +62,28 @@ function nnNode:label()
return tostring(data):gsub('\n','\\l')
end
end
- local function getmapindexstr(data)
- if not data then return '' end
- if istable(data) then
- local tstr = {}
- for i,v in ipairs(data) do
- local obj = v.module or v.input or v.data
- local str = tostring(obj)
- if obj.modules then
- str = torch.typename(obj)
- end
- table.insert(tstr, str)
- end
- return '{' .. table.concat(tstr,',') .. '}'
- else
- return tostring(data):gsub('\n','\\l')
+ local function getmapindexstr(mapindex)
+ local tstr = {}
+ for i,data in ipairs(mapindex) do
+ local inputId = 'Node' .. (data.forwardNodeId or '')
+ table.insert(tstr, inputId)
end
+ return '{' .. table.concat(tstr,',') .. '}'
end
for k,v in pairs(self.data) do
local vstr = ''
if k=='mapindex' then
- vstr = getmapindexstr(v)
+ if #v > 1 then
+ vstr = getmapindexstr(v)
+ table.insert(lbl, k .. ' = ' .. vstr)
+ end
+ elseif k=='forwardNodeId' then
+ -- the forwardNodeId is not displayed in the label.
else
vstr = getstr(v)
+ table.insert(lbl, k .. ' = ' .. vstr)
end
- table.insert(lbl, k .. ' = ' .. vstr)
end
return table.concat(lbl,"\\l")
end