You can only get 6 digits of precision with torch.float32, so if the gradient values are same till 6 digits of precision then it means your observations are a limitation of float32. Maybe adding loss1+loss2+loss3 results in the floating point error. Try printing loss and loss1, loss2, loss3 individually to see if they add up.
You can use torch.set_printoptions(precision=10) to show 10 digits in float.