pyro-ppl / pyro

Deep universal probabilistic programming with Python and PyTorch
http://pyro.ai
Apache License 2.0
8.59k stars 987 forks source link

Use more numerically stable `log1p` in examples/scanvi/scanvi.py #3397

Closed kit1980 closed 2 months ago

kit1980 commented 2 months ago

Found using TorchFix https://github.com/pytorch-labs/torchfix/

ordabayevy commented 2 months ago

Thank you for the fix! Interesting tool. Was this the only autofix found by TorchFix?

kit1980 commented 2 months ago

For this specific rule TorchFix has only linter, not autofix. So the issue was found by the tool, and I changed the code manually.

kit1980 commented 2 months ago

TorchFix finds several deprecated API usages in pyro:

pyro/distributions/omt_mvn.py:71:19: TOR101 Use of deprecated function torch.svd
pyro/distributions/transforms/householder.py:32:16: TOR101 Use of deprecated function torch.norm
pyro/distributions/transforms/sylvester.py:95:19: TOR101 [*] Use of deprecated function torch.ger
pyro/distributions/transforms/sylvester.py:99:62: TOR101 [*] Use of deprecated function torch.ger
pyro/ops/welford.py:36:25: TOR101 [*] Use of deprecated function torch.ger
pyro/ops/welford.py:75:43: TOR101 [*] Use of deprecated function torch.ger
tests/infer/test_sampling.py:81:25: TOR101 Use of deprecated function torch.norm
tests/infer/test_sampling.py:83:16: TOR101 Use of deprecated function torch.norm
tests/infer/test_sampling.py:92:25: TOR101 Use of deprecated function torch.norm
tests/infer/test_sampling.py:94:16: TOR101 Use of deprecated function torch.norm
tests/ops/test_linalg.py:46:16: TOR101 Use of deprecated function torch.triangular_solve
tests/ops/test_linalg.py:59:16: TOR101 Use of deprecated function torch.triangular_solve
tests/poutine/test_poutines.py:28:12: TOR101 Use of deprecated function torch.norm
ordabayevy commented 2 months ago

Thank you! I've made a PR with the fixes for deprecated torch functions.