.backward() is done once you have a computation graph created; where is your computation? You can see a small use case here
>>> x = torch.tensor([[1., -1.], [1., 1.]], requires_grad=True)
>>> out = x.pow(2).sum()
>>> out.backward()
>>> x.grad
tensor([[ 2.0000, -2.0000],
        [ 2.0000,  2.0000]])

on the page https://pytorch.org/docs/stable/tensors.html 7 .