def after_epoch(self):
    last_epoch = ((self.epoch + 1) == self.max_epoch)
    do_test = (not self.cfg.TEST.NO_TEST)
    meet_checkpoint_freq = ((((self.epoch + 1) % self.cfg.TRAIN.CHECKPOINT_FREQ) == 0) if (self.cfg.TRAIN.CHECKPOINT_FREQ > 0) else False)
    if (do_test and (self.cfg.TEST.FINAL_MODEL == 'best_val')):
        curr_val_acc = self.test(split='val')
        if self.cfg.NNI:
            nni.report_intermediate_result(curr_val_acc)
        is_best = (curr_val_acc > self.best_val_acc)
        if is_best:
            self.best_val_acc = curr_val_acc
            self.best_val_epoch = (self.epoch + 1)
            self.save_model(self.epoch, self.output_dir, model_name='model-best.pth.tar')
    if (do_test and self.cfg.TEST.TEST_EVERY_EPOCH):
        curr_test_acc = self.test(split='test')
        if (curr_test_acc > self.best_test_acc):
            self.best_test_acc = curr_test_acc
            self.best_test_epoch = (self.epoch + 1)
    if (meet_checkpoint_freq or last_epoch):
        self.save_model(self.epoch, self.output_dir)
def after_epoch(self):
    last_epoch = ((self.epoch + 1) == self.max_epoch)
    do_test = (not self.cfg.TEST.NO_TEST)
    meet_checkpoint_freq = ((((self.epoch + 1) % self.cfg.TRAIN.CHECKPOINT_FREQ) == 0) if (self.cfg.TRAIN.CHECKPOINT_FREQ > 0) else False)
    if (do_test and (self.cfg.TEST.FINAL_MODEL == 'best_val')):
        curr_val_acc = self.test(split='val')
        if self.cfg.NNI:
            nni.report_intermediate_result(curr_val_acc)
        is_best = (curr_val_acc > self.best_val_acc)
        if is_best:
            self.best_val_acc = curr_val_acc
            self.best_val_epoch = (self.epoch + 1)
            self.save_model(self.epoch, self.output_dir, model_name='model-best.pth.tar')
    if (do_test and self.cfg.TEST.TEST_EVERY_EPOCH):
        curr_test_acc = self.test(split='test')
        if (curr_test_acc > self.best_test_acc):
            self.best_test_acc = curr_test_acc
            self.best_test_epoch = (self.epoch + 1)
    if (meet_checkpoint_freq or last_epoch):
        self.save_model(self.epoch, self.output_dir)