From f077ea57e5ec73bc19fe01497e3bfed48397e3c2 Mon Sep 17 00:00:00 2001 From: Marcus Edel Date: Fri, 11 Feb 2022 23:27:13 -0500 Subject: [PATCH] Report the correct epoch time in seconds. (#337) --- HISTORY.md | 3 +++ include/ensmallen_bits/callbacks/progress_bar.hpp | 8 ++++---- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/HISTORY.md b/HISTORY.md index 1ab345dc6..4aeb5fb9a 100644 --- a/HISTORY.md +++ b/HISTORY.md @@ -3,6 +3,9 @@ * Update Catch2 to 2.13.8 ([#336](https://github.com/mlpack/ensmallen/pull/336)). + * Fix epoch timing output + ([#337](https://github.com/mlpack/ensmallen/pull/337)). + ### ensmallen 2.18.1: "Fairmount Bagel" ###### 2021-11-19 * Accelerate SGD test time diff --git a/include/ensmallen_bits/callbacks/progress_bar.hpp b/include/ensmallen_bits/callbacks/progress_bar.hpp index 757e9f443..6732a6962 100644 --- a/include/ensmallen_bits/callbacks/progress_bar.hpp +++ b/include/ensmallen_bits/callbacks/progress_bar.hpp @@ -216,10 +216,10 @@ class ProgressBar output << "."; } } - - const size_t stepTime = epochTimer.toc() / (double) epochSize * 1000; - output << "] " << progress << "% - " << (size_t) epochTimer.toc() % 60 - << "s " << stepTime << "ms/step " << "- loss: " << objective << "\n"; + const double epochTimerElapsed = epochTimer.toc(); + const size_t stepTime = epochTimerElapsed / (double) epochSize * 1000; + output << "] " << progress << "% - " << epochTimerElapsed + << "s/epoch; " << stepTime << "ms/step; loss: " << objective << "\n"; output.flush(); }