I don’t really understand wat are you asking for.
In addition you only can backward scalars. w is a tensor.
Gradients are not “initialize”, they are equal to None until you backpropagate something.
You can access to gradients by doing w.grad
However nothing will be returned as there are no gradients… (unless you backprop an scalar which involves w)