def METHOD_NAME(model, data_loader, optim, log_per_step=10):
    model.METHOD_NAME()
    total_loss = 0.
    total_sample = 0
    for batch, (src, dsts) in enumerate(data_loader):
        num_samples = len(src)
        src = paddle.to_tensor(src)
        dsts = paddle.to_tensor(dsts)
        loss = model(src, dsts)
        loss.backward()
        optim.step()
        optim.clear_grad()
        total_loss += float(loss) * num_samples
        total_sample += num_samples
        if batch % log_per_step == 0:
            log.info("Batch %s %s-Loss %.6f" % (batch, "train", float(loss)))
    return total_loss / total_sample