diff options
author | Adam Lerer <adam.lerer@gmail.com> | 2015-02-06 08:46:01 +0300 |
---|---|---|
committer | Adam Lerer <adam.lerer@gmail.com> | 2015-02-06 08:47:47 +0300 |
commit | 76aa0a0cd8446dccd580b431ecc0883c7bd817e3 (patch) | |
tree | dd3b4b0c21ace645676575a182ff4a5ae90d6335 | |
parent | 59d2bcf1d0c7f5d284536d377051a60bf2432b83 (diff) |
Clear correct number of progress bar spaces.
-rw-r--r-- | init.lua | 8 |
1 files changed, 5 insertions, 3 deletions
@@ -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 |