mirror of
https://github.com/pytorch/pytorch.git
synced 2025-10-20 21:14:14 +08:00
Don't fastpath conj copy when conj/neg bit mismatch (#108881)
Fixes https://github.com/pytorch/pytorch/issues/106051 Signed-off-by: Edward Z. Yang <ezyang@meta.com> Pull Request resolved: https://github.com/pytorch/pytorch/pull/108881 Approved by: https://github.com/soulitzer
This commit is contained in:
committed by
PyTorch MergeBot
parent
bd1229477d
commit
137afe74e0
@ -25,6 +25,14 @@ class TestComplexTensor(TestCase):
|
||||
x = torch.tensor([3., 3. + 5.j], device=device)
|
||||
self.assertEqual(x.dtype, torch.cdouble if dtype == torch.float64 else torch.cfloat)
|
||||
|
||||
@dtypes(*complex_types())
|
||||
def test_conj_copy(self, device, dtype):
|
||||
# issue: https://github.com/pytorch/pytorch/issues/106051
|
||||
x1 = torch.tensor([5 + 1j, 2 + 2j], device=device, dtype=dtype)
|
||||
xc1 = torch.conj(x1)
|
||||
x1.copy_(xc1)
|
||||
self.assertEqual(x1, torch.tensor([5 - 1j, 2 - 2j], device=device, dtype=dtype))
|
||||
|
||||
@onlyCPU
|
||||
@dtypes(*complex_types())
|
||||
def test_eq(self, device, dtype):
|
||||
|
Reference in New Issue
Block a user