Solved by magz in post #3 
              
              
                Thank you very much for your hint! 
Actually, it has to be 
return grad_at_out_1*b + grad_at_out_2, grad_at_out_1*a + grad_at_out_2

, so it was indeed a typo that I could’nt see anymore after staring at my own code for a while…