def backward(self, result, optimizer, opt_idx, *args, **kwargs):
    self.trainer.dev_debugger.track_event('backward_call')
    should_accumulate = self.should_accumulate()
    if isinstance(result, torch.Tensor):
        self.trainer.accelerator.backward(result, optimizer, opt_idx, should_accumulate, *args, **kwargs)
    else:
        result.closure_loss = self.trainer.accelerator.backward(result.closure_loss, optimizer, opt_idx, should_accumulate, *args, **kwargs)
    if (not self.should_accumulate()):
        self.track_and_norm_grad(optimizer=optimizer)
def backward(self, result, optimizer, opt_idx, *args, **kwargs):
    self.trainer.dev_debugger.track_event('backward_call')
    should_accumulate = self.should_accumulate()
    if isinstance(result, torch.Tensor):
        self.trainer.accelerator.backward(result, optimizer, opt_idx, should_accumulate, *args, **kwargs)
    else:
        result.closure_loss = self.trainer.accelerator.backward(result.closure_loss, optimizer, opt_idx, should_accumulate, *args, **kwargs)
    if (not self.should_accumulate()):
        self.track_and_norm_grad(optimizer=optimizer)