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

github.com/clementfarabet/lua---nnx.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorClement Farabet <clement.farabet@gmail.com>2012-01-23 09:42:36 +0400
committerClement Farabet <clement.farabet@gmail.com>2012-01-23 09:42:36 +0400
commit49c569bd81f5c0afcec42b74c63d932cf1dd950a (patch)
treec97e92fbd72a91f9510098d589f5d5cf3a52617c /SpatialFovea.lua
parent8042fefe3b277118925aedd162fe9a81c4f68f8b (diff)
Added a funky printout for SpatialFovea
Diffstat (limited to 'SpatialFovea.lua')
-rw-r--r--SpatialFovea.lua43
1 files changed, 43 insertions, 0 deletions
diff --git a/SpatialFovea.lua b/SpatialFovea.lua
index dc03301..528b422 100644
--- a/SpatialFovea.lua
+++ b/SpatialFovea.lua
@@ -345,3 +345,46 @@ function SpatialFovea:type(type)
end
return self
end
+
+function SpatialFovea:parameters()
+ local function tinsert(to, from)
+ if type(from) == 'table' then
+ for i=1,#from do
+ tinsert(to,from[i])
+ end
+ else
+ table.insert(to,from)
+ end
+ end
+ local w = {}
+ local gw = {}
+ for i=1,#self.modules do
+ local mw,mgw = self.modules[i]:parameters()
+ if mw then
+ tinsert(w,mw)
+ tinsert(gw,mgw)
+ end
+ end
+ return w,gw
+end
+
+function SpatialFovea:__tostring__()
+ local tab = ' '
+ local line = '\n'
+ local next = ' |`-> '
+ local ext = ' | '
+ local extlast = ' '
+ local last = ' ... -> '
+ local str = 'nn.SpatialFovea'
+ str = str .. ' {' .. line .. tab .. 'input'
+ for i=1,#self.processors do
+ if i == self.processors then
+ str = str .. line .. tab .. next .. '(' .. i .. '): ' .. tostring(self.processors[i]):gsub(line, line .. tab .. extlast)
+ else
+ str = str .. line .. tab .. next .. '(' .. i .. '): ' .. tostring(self.processors[i]):gsub(line, line .. tab .. ext)
+ end
+ end
+ str = str .. line .. tab .. last .. 'output'
+ str = str .. line .. '}'
+ return str
+end