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(); }