Skip to content

Commit 2e3da8a

Browse files
cyyevermeta-codesync[bot]
authored andcommitted
Simplify is_torchdynamo_compiling to direct import from torch.compiler (#5628)
Summary: Pull Request resolved: #5628 X-link: https://github.com/facebookresearch/FBGEMM/pull/2575 Pull Request resolved: #5618 Reviewed By: henrylhtsang Differential Revision: D100559702 Pulled By: q10 fbshipit-source-id: ab0f0c6db2239ffdf8429e1f576cc7caa09d7a30
1 parent 5bfb43b commit 2e3da8a

1 file changed

Lines changed: 3 additions & 19 deletions

File tree

fbgemm_gpu/fbgemm_gpu/split_table_batched_embeddings_ops_training_common.py

Lines changed: 3 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -9,25 +9,9 @@
99

1010
from typing import List, Optional
1111

12-
import torch
13-
from torch import Tensor
14-
15-
try:
16-
try:
17-
from torch.compiler import is_compiling
18-
19-
def is_torchdynamo_compiling() -> bool: # type: ignore[misc]
20-
# at least one test fails if we import is_compiling as a different name
21-
return is_compiling()
22-
23-
except Exception:
24-
# torch.compiler.is_compiling is not available in torch 1.10
25-
from torch._dynamo import is_compiling as is_torchdynamo_compiling
26-
except Exception:
27-
28-
def is_torchdynamo_compiling() -> bool: # type: ignore[misc]
29-
return False
30-
12+
import torch # usort:skip
13+
from torch import Tensor # usort:skip
14+
from torch.compiler import is_compiling as is_torchdynamo_compiling # usort:skip
3115

3216
# @manual=//deeplearning/fbgemm/fbgemm_gpu/codegen:split_embedding_codegen_lookup_invokers
3317
import fbgemm_gpu.split_embedding_codegen_lookup_invokers as invokers

0 commit comments

Comments
 (0)