If the gradients are not None but close to zero, the gradient calculation was performed, but your gradient might vanish.
Using your model I get valid gradients for the input:
net2 = nn.Sequential(
    nn.Linear(10, 10),
    nn.Tanh(),
    nn.Linear(10, 10),
    nn.Tanh()
)

x = torch.randn(1, 10, requires_grad=True)
out = net2(x)
out.mean().backward()
print(x.grad)
> tensor([[-0.0204,  0.0356, -0.0084, -0.0122,  0.0018, -0.0206,  0.0270,  0.0311,
          0.0075,  0.0081]])

PS: Variables are deprecated since PyTorch 0.4.0, so you can use tensors now.