Skip to content

Commit

Permalink
Added a funky printout for SpatialFovea
Browse files Browse the repository at this point in the history
  • Loading branch information
clementfarabet committed Jan 23, 2012
1 parent 8042fef commit 49c569b
Showing 1 changed file with 43 additions and 0 deletions.
43 changes: 43 additions & 0 deletions SpatialFovea.lua
Expand Up @@ -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

0 comments on commit 49c569b

Please sign in to comment.