Try this:
for t in range(2000):
    optimizer.zero_grad()
    prediction = net(X)    
    loss = loss_func(prediction, y)       
    loss.backward()         
    optimizer.step()        

    if t % 5 == 0:
        print(loss.data.numpy())

Also, you might need to lower the learning rate as I described above