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:
authorkoray kavukcuoglu <koray@kavukcuoglu.org>2015-01-13 14:41:54 +0300
committerkoray kavukcuoglu <koray@kavukcuoglu.org>2015-01-13 14:41:54 +0300
commit518b60b632179b09db4b06c953c2ac4fc66097ce (patch)
treeb3538d01f23bd59d3c443de3ebc950da0641f1e5
parentac66714505032e85f734cf197a8d224060da3f17 (diff)
add name function to create named nodes to easily inspect in the graph
-rw-r--r--node.lua11
1 files changed, 9 insertions, 2 deletions
diff --git a/node.lua b/node.lua
index f4d75ab..53e7a12 100644
--- a/node.lua
+++ b/node.lua
@@ -44,6 +44,13 @@ function nnNode:split(noutput)
return unpack(selectnodes)
end
+function nnNode:name(name)
+ if self.data and istable(self.data) then
+ self.data.name = name
+ end
+ return self
+end
+
function nnNode:label()
local lbl = {}
@@ -78,12 +85,12 @@ function nnNode:label()
for k,v in pairs(self.data) do
local vstr = ''
- if k=='mapindex' then
+ if k == 'mapindex' then
if #v > 1 then
vstr = getmapindexstr(v)
table.insert(lbl, k .. ' = ' .. vstr)
end
- elseif k=='forwardNodeId' then
+ elseif k == 'forwardNodeId' then
-- the forwardNodeId is not displayed in the label.
else
vstr = getstr(v)