-
Notifications
You must be signed in to change notification settings - Fork 27.3k
Closed
Labels
module: NaNs and InfsProblems related to NaN and Inf handling in floating pointProblems related to NaN and Inf handling in floating pointmodule: complexRelated to complex number support in PyTorchRelated to complex number support in PyTorchtriagedThis issue has been looked at a team member, and triaged and prioritized into an appropriate moduleThis issue has been looked at a team member, and triaged and prioritized into an appropriate module
Description
This behavior leads to failure in testing for CPU where nan's are tested for equality with strictness.
import torch
t = torch.tensor([complex(0, float('inf'))] * 4)
out_non_vec = torch.sgn(t)
ref = torch.tensor([complex(float('nan'), float('nan'))] * 4)
print(out_non_vec)
are_equal, msg = torch.testing._compare_tensors_internal(out_non_vec, ref, equal_nan=True, rtol=0, atol=0)
print("EQUAL:", are_equal)
t = torch.tensor([complex(0, float('inf'))] * 9)
out_vec = torch.sgn(t)
ref = torch.tensor([complex(float('nan'), float('nan'))] * 9)
print(out_vec)
are_equal, msg = torch.testing._compare_tensors_internal(out_vec, ref, equal_nan=True, rtol=0, atol=0)
print("EQUAL:", are_equal)Output:
tensor([nan+nanj, nan+nanj, nan+nanj, nan+nanj])
EQUAL: True
tensor([0.+nanj, 0.+nanj, 0.+nanj, 0.+nanj, 0.+nanj, 0.+nanj, 0.+nanj, 0.+nanj, nan+nanj])
EQUAL: False
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
module: NaNs and InfsProblems related to NaN and Inf handling in floating pointProblems related to NaN and Inf handling in floating pointmodule: complexRelated to complex number support in PyTorchRelated to complex number support in PyTorchtriagedThis issue has been looked at a team member, and triaged and prioritized into an appropriate moduleThis issue has been looked at a team member, and triaged and prioritized into an appropriate module