The first argument you feed when initializing any optimizer should be an iterable of Variables or dictionaries containing Variables. In your case a simple list containing w1 and w2 should be fine as long as those are Variables that require gradients.
import torch
import torch.optim as optim
from torch.autograd import Variable

w = Variable(torch.randn(3, 5), requires_grad=True)
b = Variable(torch.randn(3), requires_grad=True)
x = Variable(torch.randn(5))

optimizer = optim.SGD([w,b], lr=0.01)

optimizer.zero_grad()
y = torch.mv(w, x) + b
y.backward(torch.randn(3))
optimizer.step()