def METHOD_NAME(
    self, sample, model, criterion, optimizer, update_num, ignore_grad=False
):
    model.train()
    sample["prev_target"] = self.inject_noise(sample["target"])
    loss, sample_size, logging_output = criterion(model, sample)
    if ignore_grad:
        loss *= 0
    optimizer.backward(loss)
    return loss, sample_size, logging_output