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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Wrongly returns nan for vectorized complex numbers division on PPC/ZArch #109870

Open
Flamefire opened this issue Sep 22, 2023 · 0 comments
Open
Labels
module: POWER Issues specific to the POWER/ppc architecture triaged This issue has been looked at a team member, and triaged and prioritized into an appropriate module

Comments

@Flamefire
Copy link
Collaborator

Flamefire commented Sep 22, 2023

馃悰 Describe the bug

Copied from #92043 which still applies for vectorized PPC and likely to ZArch while it was fixed for x86 by #93277

Pytorch wrongly returns nan for complex numbers division where the results are still within the range of the datatype.
For example: (0.0 + 0.0j) / (1e-36 + 0.0j) in complex64. In this case, both operands and the results (which is 0) are within the defined range of complex64. However, it returns (nan + nanj).

Here's the reproducing code:

a = torch.tensor([0.0 + 0.0j]*8)
b = torch.tensor([1e-36 + 0.0j]*8)
print(a / b)  # it's (nan + nanj),...

Or just run test_complex_div_underflow_overflow.

The reason is that abs_2_ already overflows in the tested range (e.g. finfo.min / 2 in test_complex_div_underflow_overflow) and the elwise_mult(vr) does too.

Versions

PyTorch 2.1.0

@cpuhrsch cpuhrsch added module: POWER Issues specific to the POWER/ppc architecture triaged This issue has been looked at a team member, and triaged and prioritized into an appropriate module labels Sep 23, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
module: POWER Issues specific to the POWER/ppc architecture triaged This issue has been looked at a team member, and triaged and prioritized into an appropriate module
Projects
None yet
Development

No branches or pull requests

2 participants