Solved by Nikronic in post #2 
              
              
                Hi, 
Because you are not using any gradient value from any operation after you custom autograd function. 

If you check your backward method, you have a argument u which contains all grads from operations after Square. Because you are not using it, no matter what you do, it just breaks the all backw…