def _process_training_step_output(self, training_step_output, split_batch):
    training_step_output_for_epoch_end = training_step_output
    if (training_step_output_for_epoch_end is None):
        return (None, None)
    result = self.trainer.lightning_module._results
    loss = None
    hiddens = None
    result['extra'] = {}
    if isinstance(training_step_output, dict):
        loss = training_step_output.pop('loss', None)
        hiddens = training_step_output.pop('hiddens', None)
        if (hiddens is not None):
            hiddens = hiddens.detach()
        result['extra'] = training_step_output
    elif isinstance(training_step_output, torch.Tensor):
        loss = training_step_output
    result.minimize = loss
    self.trainer.hiddens = hiddens
    result.track_batch_size(len(split_batch))
    training_step_output_for_epoch_end = copy(result)
    training_step_output_for_epoch_end = training_step_output_for_epoch_end.detach()
    if self.trainer.move_metrics_to_cpu:
        training_step_output_for_epoch_end = training_step_output_for_epoch_end.cpu()
    return (training_step_output_for_epoch_end, result)
def _process_training_step_output(self, training_step_output, split_batch):
    training_step_output_for_epoch_end = training_step_output
    if (training_step_output_for_epoch_end is None):
        return (None, None)
    result = self.trainer.lightning_module._results
    loss = None
    hiddens = None
    result['extra'] = {}
    if isinstance(training_step_output, dict):
        loss = training_step_output.pop('loss', None)
        hiddens = training_step_output.pop('hiddens', None)
        if (hiddens is not None):
            hiddens = hiddens.detach()
        result['extra'] = training_step_output
    elif isinstance(training_step_output, torch.Tensor):
        loss = training_step_output
    result.minimize = loss
    self.trainer.hiddens = hiddens
    result.track_batch_size(len(split_batch))
    training_step_output_for_epoch_end = copy(result)
    training_step_output_for_epoch_end = training_step_output_for_epoch_end.detach()
    if self.trainer.move_metrics_to_cpu:
        training_step_output_for_epoch_end = training_step_output_for_epoch_end.cpu()
    return (training_step_output_for_epoch_end, result)