sorry about the mistake:
I found it.you missed:
        b1.grad.data.zero_()
        b2.grad.data.zero_()

also print
 print(epoch, (error**2).mean().data[0])

you should get similar results as numpy.