pytorch/test/distributions
Juhyeong (Odd) Kim c77857cb83 Improve numerical stability of torch.distributions.wishart.Wishart (#72993)
Summary:
Maintanance of https://github.com/pytorch/pytorch/pull/70377
Multiple modifications of the merged initial implementation of Wishart distribution.

Key modifications:
* torch/distributions/wishart.py: Clamp (Clip) float type values to calculate reciprocal in numerically stable manner, by using the eps value paired to each torch.dtype
* test/distributions/test_distributions.py: Test Wishart distribution implementation in numerically unstable zones, i.e df values are at ndim - 1 < df < ndim where ndim is the one dimenstion of the Wishart parameter & sample matrix.

Re-opened reverted PR https://github.com/pytorch/pytorch/issues/72059
cc neerajprad vadimkantorov

Pull Request resolved: https://github.com/pytorch/pytorch/pull/72993

Reviewed By: samdow

Differential Revision: D34853807

Pulled By: neerajprad

fbshipit-source-id: eb62dca19bf8a934fdf59b4ffc58587447fe8378
(cherry picked from commit 99240c0d947e2faeb7beae91164ede41f61d8448)
2022-03-15 18:30:08 +00:00
..
test_constraints.py [torch.distributions] Implement positive-semidefinite constraint (#71375) 2022-01-20 17:33:08 +00:00
test_distributions.py Improve numerical stability of torch.distributions.wishart.Wishart (#72993) 2022-03-15 18:30:08 +00:00
test_transforms.py Add SoftplusTransform (#52300) 2022-02-25 02:30:03 +00:00
test_utils.py Set test owner for distributions tests (#66842) 2021-10-19 11:00:29 -07:00