Skip to content

Commit b5021ba

Browse files
fduwjjpytorchmergebot
authored andcommitted
Enable torch.is_complex in Dynamo tracing (#103154)
Pull Request resolved: #103154 Approved by: https://github.com/yanboliang
1 parent 2e8d2a2 commit b5021ba

File tree

2 files changed

+8
-0
lines changed

2 files changed

+8
-0
lines changed

test/dynamo/test_functions.py

+7
Original file line numberDiff line numberDiff line change
@@ -436,6 +436,13 @@ def test_get_default_dtype(x):
436436
else:
437437
return x - 1
438438

439+
@make_test
440+
def test_is_complex(x):
441+
if torch.is_complex(x):
442+
return x + 1
443+
else:
444+
return x - 1
445+
439446
@make_test
440447
def test_device(x):
441448
if not x.is_cuda:

torch/_dynamo/variables/torch.py

+1
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,7 @@
7373
torch.is_autocast_cache_enabled,
7474
torch.is_autocast_cpu_enabled,
7575
torch.is_autocast_enabled,
76+
torch.is_complex,
7677
torch.is_floating_point,
7778
torch.nn.functional._Reduction.get_enum,
7879
]

0 commit comments

Comments
 (0)