Solved by AlbanOdot in post #5 
              
              
                I’m glad you figured it out by yourself @lui.bonati. 
So backward default settings is for a single value tensor. 
c.backward() == c.backward(torch.ones(1))

If you want to apply it to a vector you might want to pass a parameter in your backward function. 
Let’s say x is a tensor correctly setup and …