fix mocked trainer
+from __future__ import division
import os
import shutil
import tempfile
@@ -157,11 +158,17 @@ def _get_mocked_trainer(stop_trigger=(10, 'iteration')):
updater = mock.Mock()
updater.get_all_optimizers.return_value = {}
updater.iteration = 0
- updater.epoch_detail = 1
+ updater.epoch = 0
+ updater.epoch_detail = 0
+ updater.is_new_epoch = True
+ iter_per_epoch = 10
def update():
time.sleep(0.001)
updater.iteration += 1
+ updater.epoch = updater.iteration // iter_per_epoch
+ updater.epoch_detail = updater.iteration / iter_per_epoch
+ updater.is_new_epoch = updater.epoch == updater.epoch_detail
updater.update = update
return training.Trainer(updater, stop_trigger)
