outputs of training_epoch_end for different configure_optimizers conditions 
Condition One:
when I write optimizer as follows:

def configure_optimizers(self):
  return [disOptim,genOptim],[] 


I can simply write the training_epoch_end as follows:

def training_epoch_end(self,outputs):
  sum_loss_D_real=torch.stack([x['D_loss_real'] for x in outputs[0]]).sum()


Condition Two:
However when I write the optimizer as follows:

def configure_optimizers(self):
  return ({'optimizer':disOptim,'frequency':2},{'optimizer':genOptim,'frequency':1})


I need to write the training_epoch_end as follows:

def training_epoch_end(self,outputs):
  mean_d_loss=torch.stack([outputs[i]['d_loss'] for i in range(len(outputs)) if ((i+1)%(self.hparams.n_critic+1))]).mean()


Is there any way that I can write the optimizer the same as condition two and the training_epoch_end as condition one?