Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

torch._standard_gamma() has accuracy gap compared to scipy and torch.cpu #1163

Open
daisyden opened this issue Dec 12, 2024 · 3 comments
Open
Assignees

Comments

@daisyden
Copy link
Contributor

🐛 Describe the bug

test_distributions_xpu.py::TestDistributionsXPU::test_gamma_gpu_sample_xpu FAILED [100%]

============================================================================== FAILURES ===============================================================================
___________________________________________________________ TestDistributionsXPU.test_gamma_gpu_sample_xpu ____________________________________________________________
Traceback (most recent call last):
File "/home/gta/daisyden/rebase/n1_ci/third_party/torch-xpu-ops/test/xpu/test_distributions_xpu.py", line 119, in _test_gamma_gpu_sample
self._check_sampler_sampler(
File "/home/gta/daisyden/rebase/n1_ci/third_party/torch-xpu-ops/test/xpu/../../../../test/distributions/test_distributions.py", line 1289, in _check_sampler_sampler
self.assertLess(-threshold, bias, message)
File "/home/gta/miniforge3/envs/n2/lib/python3.10/unittest/case.py", line 1232, in assertLess
self.fail(self._formatMessage(msg, standardMsg))
File "/home/gta/miniforge3/envs/n2/lib/python3.10/unittest/case.py", line 675, in fail
raise self.failureException(msg)
AssertionError: -0.06743384440339613 not less than -0.259 : Gamma(alpha=1.0, beta=0.1).sample() is biased:
[-0.259 -0.264 -0.243 -0.059 1. 0.951 -0.279 -0.274 -0.296 -0.277]

To execute this test, run the following from the base repo dir:
python test/distributions/test_distributions.py TestDistributionsXPU.test_gamma_gpu_sample_xpu

Versions

with 2024/12/09 nightly wheel, no such issue on preci.

@daisyden
Copy link
Contributor Author

Tried cpu _standard_gamma tensor, no such issue.

@PenghuiCheng
Copy link
Contributor

fixed:#1161

@daisyden
Copy link
Contributor Author

Seems this issue exists or not on different driver versions, investigation is WIP.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants