Yes that is what I tried so now
for t in range(2000):
    prediction = net(X)    

    loss = loss_func(prediction, y)       
    loss.backward()         
    optimizer.step()        

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

yes it is before prediction
and I just compared results from model with training data its still looks like not learning anything

hence loss is very high