def METHOD_NAME(self, loss, **moving_averages):
    if self.hypers.n_gpu > 1:
        loss = loss.mean()  # mean() to average on multi-gpu parallel training
    loss_val = loss.item()
    if self.hypers.gradient_accumulation_steps > 1:
        loss = loss / self.hypers.gradient_accumulation_steps
    if self.hypers.fp16:
        with amp.scale_loss(loss, self.optimizer) as scaled_loss:
            scaled_loss.backward()
    else:
        loss.backward()
    self.reporting.moving_averages(loss=loss_val, **moving_averages)
    return loss_val