Allow torch.Tensor.real on real-valued tensors (#71718)

Summary: Pull Request resolved: https://github.com/pytorch/pytorch/pull/71718

Test Plan: Imported from OSS

Reviewed By: albanD

Differential Revision: D33770668

Pulled By: anjali411

fbshipit-source-id: bad21ebe72220b9017a0b8efa71eaeab84bd9e9f
(cherry picked from commit aa0a922757277ac7b3ad4d633648a89c385ccc0d)
This commit is contained in:
anjali411
2022-01-25 13:50:48 -08:00
committed by PyTorch MergeBot
parent 03f1f0cfe4
commit de8d0203e9
5 changed files with 7 additions and 12 deletions

View File

@ -150,8 +150,6 @@ class TestTensorBuiltins(JitTestCase):
# real and imag are only implemented for complex tensors.
self.assertRaises(RuntimeError, lambda: should_keep(tensor, 'imag'))
keys.remove('imag')
self.assertRaises(RuntimeError, lambda: should_keep(tensor, 'real'))
keys.remove('real')
properties = [p for p in keys if should_keep(tensor, p)]