From 5b9f205e445742ebbbd7592bb855219f8aef1b4d Mon Sep 17 00:00:00 2001 From: Nic Ma Date: Wed, 27 Oct 2021 18:24:38 +0800 Subject: [PATCH] [DLMED] fix iteration bug Signed-off-by: Nic Ma --- monai/handlers/stats_handler.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/monai/handlers/stats_handler.py b/monai/handlers/stats_handler.py index 7c88634820..32eaa07d61 100644 --- a/monai/handlers/stats_handler.py +++ b/monai/handlers/stats_handler.py @@ -237,9 +237,9 @@ def _default_iteration_print(self, engine: Engine) -> None: return # no value to print num_iterations = engine.state.epoch_length - current_iteration = engine.state.iteration - 1 + current_iteration = engine.state.iteration if num_iterations is not None: - current_iteration %= num_iterations + 1 + current_iteration = (current_iteration - 1) % num_iterations + 1 current_epoch = engine.state.epoch num_epochs = engine.state.max_epochs