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

github.com/torch/xlua.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSoumith Chintala <soumith@gmail.com>2015-02-06 09:18:31 +0300
committerSoumith Chintala <soumith@gmail.com>2015-02-06 09:18:31 +0300
commitb41d77acb301d5f70cb60f798b543eb09fe019e7 (patch)
treedd3b4b0c21ace645676575a182ff4a5ae90d6335
parent59d2bcf1d0c7f5d284536d377051a60bf2432b83 (diff)
parent76aa0a0cd8446dccd580b431ecc0883c7bd817e3 (diff)
Merge pull request #5 from adamlerer/master
Clear correct number of progress bar spaces.
-rw-r--r--init.lua8
1 files changed, 5 insertions, 3 deletions
diff --git a/init.lua b/init.lua
index 6af7c20..b29bc13 100644
--- a/init.lua
+++ b/init.lua
@@ -231,6 +231,7 @@ end
do
local barDone = true
local previous = -1
+ local tm = ''
local timer
local times
local indices
@@ -247,6 +248,7 @@ do
if (barDone and ((previous == -1) or (percent < previous))) then
barDone = false
previous = -1
+ tm = ''
timer = torch.Timer()
times = {timer:time().real}
indices = {current}
@@ -266,8 +268,8 @@ do
end
glob.io.write('] ')
-- time stats
- for i=1,50 do glob.io.write(' ') end
- for i=1,50 do glob.io.write('\b') end
+ for i=1,#tm do glob.io.write(' ') end
+ for i=1,#tm do glob.io.write('\b') end
local elapsed = timer:time().real
local step = (elapsed-times[1]) / (current-indices[1])
if current==indices[1] then step = 0 end
@@ -278,7 +280,7 @@ do
indices = table.splice(indices)
times = table.splice(times)
end
- local tm = 'ETA: ' .. formatTime(remaining) .. ' | Step: ' .. formatTime(step)
+ tm = 'ETA: ' .. formatTime(remaining) .. ' | Step: ' .. formatTime(step)
glob.io.write(tm)
-- go back to center of bar, and print progress
for i=1,47+#tm do glob.io.write('\b') end