Pass both parameters to the optimizer and it should work:
x = torch.randn(10, 10) # your input
weight = nn.Parameter(torch.from_numpy(np.random.randn(10, 10)).float())
bias = nn.Parameter(torch.from_numpy(np.random.randn(10)).float())

optimizer = torch.optim.SGD([weight] + [bias], lr=1e-3)
target = torch.randn(10, 10)
criterion = nn.MSELoss()

for epoch in range(10):
    optimizer.zero_grad()
    out = F.relu(F.linear(x, weight, bias))
    loss = criterion(out, target)
    loss.backward()
    optimizer.step()
    print('epoch {}, loss {}'.format(epoch, loss.item()))