def _process_closure_result(self, batch_outputs: list, opt_idx: int) -> list:
    opt_closure_result = self._curr_step_result
    if (opt_closure_result is not None):
        self.trainer.logger_connector.cache_training_step_metrics(opt_closure_result)
        if self.trainer.terminate_on_nan:
            self._check_finite(opt_closure_result.loss)
        batch_opt_idx = (opt_idx if (len(batch_outputs) > 1) else 0)
        batch_outputs[batch_opt_idx].append(opt_closure_result.training_step_output_for_epoch_end)
        if self.trainer.lightning_module.automatic_optimization:
            self.accumulated_loss.append(opt_closure_result.loss)
    self._curr_step_result = None
    return batch_outputs
def _process_closure_result(self, batch_outputs: list, opt_idx: int) -> list:
    opt_closure_result = self._curr_step_result
    if (opt_closure_result is not None):
        self.trainer.logger_connector.cache_training_step_metrics(opt_closure_result)
        if self.trainer.terminate_on_nan:
            self._check_finite(opt_closure_result.loss)
        batch_opt_idx = (opt_idx if (len(batch_outputs) > 1) else 0)
        batch_outputs[batch_opt_idx].append(opt_closure_result.training_step_output_for_epoch_end)
        if self.trainer.lightning_module.automatic_optimization:
            self.accumulated_loss.append(opt_closure_result.loss)
    self._curr_step_result = None
    return batch_outputs