Skip to content

Commit

Permalink
[Dynamo] Supports torch._C._is_any_autocast_enabled (#126196)
Browse files Browse the repository at this point in the history
Fixes #126026

Pull Request resolved: #126196
Approved by: https://github.com/anijain2305
  • Loading branch information
yanboliang authored and ZelboK committed May 19, 2024
1 parent a745003 commit 976f0f2
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
7 changes: 7 additions & 0 deletions test/dynamo/test_functions.py
Original file line number Diff line number Diff line change
Expand Up @@ -642,6 +642,13 @@ def test_get_autocast_gpu_dtype(x):
dtype = torch.get_autocast_gpu_dtype()
return x.type(dtype)

@make_test
def test_is_any_autocast_enabled(x):
if torch._C._is_any_autocast_enabled():
return x + 1
else:
return x - 1

@make_test
def test_list_compare_polyfill(x):
for a, b, c in [
Expand Down
1 change: 1 addition & 0 deletions torch/_dynamo/variables/torch.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@
torch._assert,
torch._utils._get_device_index,
torch._C._get_cublas_allow_tf32,
torch._C._is_any_autocast_enabled,
torch.cuda.get_device_properties,
torch.cuda.is_available,
torch.distributed.is_available,
Expand Down

0 comments on commit 976f0f2

Please sign in to comment.