projects
/
profiler-torch.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Changed the timing display.
[profiler-torch.git]
/
profiler.lua
diff --git
a/profiler.lua
b/profiler.lua
index
58100e7
..
5490651
100755
(executable)
--- a/
profiler.lua
+++ b/
profiler.lua
@@
-77,20
+77,25
@@
function profiler.decor(model, functionsToDecorate)
end
end
-function profiler.print(model, nbSamples)
- print('----------------------------------------------------------------------')
- print(model)
+function profiler.print(model, nbSamples
, indent
)
+ local indent = indent or ''
+
if nbSamples then
if nbSamples then
- print(string.format('acc_time %.02fs (%.01fmus/sample)',
+ print(string.format('%s%s %.02fs (%.01fmus/sample)',
+ indent,
+ model.__typename,
model.accTime,
1e6 * model.accTime / nbSamples))
else
model.accTime,
1e6 * model.accTime / nbSamples))
else
- print(string.format('acc_time %.02fs', model.accTime))
+ print(string.format('%s%s %.02fs',
+ indent,
+ model.__typename,
+ model.accTime))
end
if torch.isTypeOf(model, nn.Container) then
for _, m in ipairs(model.modules) do
end
if torch.isTypeOf(model, nn.Container) then
for _, m in ipairs(model.modules) do
- profiler.print(m, nbSamples)
+ profiler.print(m, nbSamples
, indent .. ' '
)
end
end
end
end
end
end