I think you want to move on to register_full_backward_hook on nightlies:
  
      github.com/pytorch/pytorch
  
  
    
  
    
  

  
    
      Fix Module backward hooks for all Tensor inputs/outputs 7
    

    
      pytorch:master ← albanD:bw_hook
    

    
      
        opened 
        
          
        
        Oct 11, 2020
      
      

      
        
          
          albanD
        
      

      
        
          +491
          -50