def METHOD_NAME(self, trainer):
    cur_iter = self.get_iter(
        trainer, inner_iter=True
    ) if trainer.mode == ModeKeys.TRAIN else trainer.iters_per_epoch
    log_dict = OrderedDict(
        mode=trainer.mode, epoch=self.get_epoch(trainer), iter=cur_iter)
    # statistic memory
    if torch.cuda.is_available():
        log_dict[LogKeys.MEMORY] = self._get_max_memory(trainer)
    log_dict = dict(log_dict, **trainer.log_buffer.output)
    self._log_info(log_dict, trainer)
    self._dump_log(log_dict)
    return log_dict