Solved by albanD in post #4 
              
              
                The idea is that the gradient of 2*x is 2. So whatever is the value of x during the forward, it does not change the value of the gradient. 
On the other hand, for x**2, the gradient is 2*x and so depending on the value x used in the forward, the gradient will change.