Remove duplicate epoch_end hooks in the Lightning Module
🚀 Feature
This isn't a feature as much as API refinement we should do.
These 2 sets of hooks are redundant:

{training/validation/test}_epoch_end = defined inside the LightningModule: 
  
    
      pytorch-lightning/pytorch_lightning/core/lightning.py
    
    
        Lines 652 to 691
      in
      b7a22ba
    
  
  
    

        
          
               def training_epoch_end(self, outputs: List[Any]) -> None: 
        

        
          
                   """ 
        

        
          
                   Called at the end of the training epoch with the outputs of all training steps. 
        

        
          
                   Use this in case you need to do something with all the outputs for every training_step. 
        

        
          
            
        

        
          
                   .. code-block:: python 
        

        
          
            
        

        
          
                       # the pseudocode for these calls 
        

        
          
                       train_outs = [] 
        

        
          
                       for train_batch in train_data: 
        

        
          
                           out = training_step(train_batch) 
        

        
          
                           train_outs.append(out) 
        

        
          
                       training_epoch_end(train_outs) 
        

        
          
            
        

        
          
                   Args: 
        

        
          
                       outputs: List of outputs you defined in :meth:`training_step`, or if there are 
        

        
          
                           multiple dataloaders, a list containing a list of outputs for each dataloader. 
        

        
          
            
        

        
          
                   Return: 
        

        
          
                       None 
        

        
          
            
        

        
          
                   Note: 
        

        
          
                       If this method is not overridden, this won't be called. 
        

        
          
            
        

        
          
                   Example:: 
        

        
          
            
        

        
          
                       def training_epoch_end(self, training_step_outputs): 
        

        
          
                           # do something with all training_step outputs 
        

        
          
                           return result 
        

        
          
            
        

        
          
                   With multiple dataloaders, ``outputs`` will be a list of lists. The outer list contains 
        

        
          
                   one entry per dataloader, while the inner list contains the individual outputs of 
        

        
          
                   each training step for that dataloader. 
        

        
          
            
        

        
          
                   .. code-block:: python 
        

        
          
            
        

        
          
                       def training_epoch_end(self, training_step_outputs): 
        

        
          
                           for out in training_step_outputs: 
        

        
          
                               # do something here 
        

        
          
                   """ 
        
    
  


on_{train/val/test}_epoch_end = defined inside core/hooks: 
  
    
      pytorch-lightning/pytorch_lightning/core/hooks.py
    
    
        Lines 207 to 211
      in
      b7a22ba
    
  
  
    

        
          
               def on_train_epoch_end(self, outputs: List[Any]) -> None: 
        

        
          
                   """ 
        

        
          
                   Called in the training loop at the very end of the epoch. 
        

        
          
                   """ 
        

        
          
                   # do something when the epoch ends 
        
    
  



Both take the step outputs from that epoch for post-processing, which is confusing for users. Which ones should users implement for post-processing?
@kaushikb11 @tchaton @edenafek
Motivation
Clarify the API
Pitch
Turn it back how it used to be before:

{training/validation/test}_epoch_end gets the step outputs for post-processing. If the LightningModule implements this, then the Trainer retains the step outputs during execution. If not, we save memory and discard the step outputs.
on_{train/val/test}_epoch_end takes no arguments and runs after {training/validation/test}_epoch_end is called. The user has a chance to persist outputs from the first hook before the second runs, but it doesn't need to be passed through by the trainer.


Alternatives

Additional context