it’s not rounded in torch, it just print in this format
in pytorch, you should use loss=error.pow(2).sum()/2.to get the same grad as numpy----sorry about the mistake.
if it still doesn’t work, you can print w1.grad.data, and compare to the grad you compute. that may be helpful.