def METHOD_NAME(epoch, model, criterion, optimizer, loader, writer, args):
    model.METHOD_NAME()
    meters = AverageMeterGroup()
    cur_lr = optimizer.param_groups[0]["lr"]
    for step, (x, y) in enumerate(loader):
        x, y = x.to('cuda'), y.to('cuda')
        cur_step = len(loader) * epoch + step
        optimizer.zero_grad()
        logits = model(x)
        loss = criterion(logits, y)
        loss.backward()
        optimizer.step()
        metrics = accuracy(logits, y)
        metrics["loss"] = loss.item()
        meters.update(metrics)
        writer.add_scalar("lr", cur_lr, global_step=cur_step)
        writer.add_scalar("loss/train", loss.item(), global_step=cur_step)
        writer.add_scalar("acc1/train", metrics["acc1"], global_step=cur_step)
        writer.add_scalar("acc5/train", metrics["acc5"], global_step=cur_step)
        if step % args.log_frequency == 0 or step + 1 == len(loader):
            logger.info("Epoch [%d/%d] Step [%d/%d]  %s", epoch + 1,
                        args.epochs, step + 1, len(loader), meters)
    logger.info("Epoch %d training summary: %s", epoch + 1, meters)