Update the div formula for numerical stability (#43627)
Summary:
Fixes https://github.com/pytorch/pytorch/issues/43414
See the issue for numerical improvements and quick benchmark.
Pull Request resolved: https://github.com/pytorch/pytorch/pull/43627
Reviewed By: agolynski
Differential Revision: D23350124
Pulled By: albanD
fbshipit-source-id: 19d51640b3f200db37c32d2233a4244480e5a15b