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

What is the expected result of float64 div when divisor and dividend are the same? #1160

Open
daisyden opened this issue Dec 11, 2024 · 0 comments
Assignees

Comments

@daisyden
Copy link
Contributor

🐛 Describe the bug

When the two tensors are the same, what is the expected result? It is 1.0 or a number close to 1.0? This will lead to different result when apply trunc, lead to the UT failures.

FAILED test_ops_xpu.py::TestCommonXPU::test_python_ref__refs_div_trunc_rounding_xpu_float64 - Exception: Caused by reference input at index 16: SampleInput
FAILED test_ops_xpu.py::TestCommonXPU::test_python_ref_executor__refs_div_trunc_rounding_executor_aten_xpu_float64 - Exception: Caused by reference input at index 16: SampleInput
FAILED test_ops_xpu.py::TestCommonXPU::test_python_ref_torch_fallback__refs_div_trunc_rounding_xpu_float64 - Exception: Caused by reference input at index 16: SampleInput

(Pdb) f1=torch.tensor(-501., device='xpu:0', dtype=torch.float64)
(Pdb) e1=f1
(Pdb) torch.div(f1, e1, rounding_mode='trunc')
tensor(1., device='xpu:0', dtype=torch.float64)
(Pdb) torch.div(f1, e1)
tensor(0.9999999999999998889776975374843459576368331909179687500000000000,
device='xpu:0', dtype=torch.float64)
(Pdb) torch.trunc(torch.div(f1, e1))
tensor(0., device='xpu:0', dtype=torch.float64)

Versions

torch-xpu-ops 1209 nightly build.

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

2 participants