Hi,
the difference is that in the first two examples, you override x (and so the x you look for gradients is not the leaf Tensor that you created) while in the last one, you put the result in y directly.