Skip to content

Commit 7eb2e07

Browse files
crcrpart-vi
andauthored
remove unused to_torch_translator (#1830)
Co-authored-by: Thomas Viehmann <[email protected]>
1 parent 92bdda8 commit 7eb2e07

File tree

2 files changed

+0
-36
lines changed

2 files changed

+0
-36
lines changed

docs/source/reference/executors/torch_compile.rst

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,5 @@ Torch Compile Executor
88
.. autosummary::
99
:toctree: generated/
1010

11-
to_torch_translator
1211
make_compiled
1312
TorchCompileExecutor

thunder/executors/torch_compile.py

Lines changed: 0 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -26,41 +26,6 @@
2626
_TORCH_GREATER_EQUAL_2_3 = compare_version("torch", operator.ge, "2.3.0", use_base_version=True)
2727

2828

29-
def to_torch_translator(bsym: BoundSymbol) -> Callable:
30-
"""Translates a BoundSymbol to a corresponding traceable by Thunder and
31-
executable by PyTorch callable.
32-
33-
Args:
34-
bsym: The BoundSymbol to translate.
35-
36-
Returns:
37-
A callable that can be executed by PyTorch after being traced by Thunder.
38-
"""
39-
40-
def _to_torch(*args, **kwargs) -> Any:
41-
impl_info = pytorch_ex.implmap.get(bsym.sym.id)
42-
torch_op = None
43-
if impl_info is not None:
44-
torch_op = impl_info.symbol
45-
if impl_info.execution_transform is not None:
46-
return impl_info.execution_transform(*args, **kwargs)
47-
48-
if torch_op is None:
49-
torch_op = pytorch_ex.opmap.get(bsym.sym.name)
50-
51-
# this should be really rare, but type_as has this,
52-
# ideally we would be also handling more subsymbols here
53-
if torch_op is None and len(bsym.subsymbols) == 1:
54-
torch_op = pytorch_ex.opmap.get(bsym.subsymbols[0].sym.name)
55-
56-
if torch_op is None:
57-
raise RuntimeError(f"op not found for {bsym.sym.name}")
58-
59-
return torch_op(*args, **kwargs)
60-
61-
return _to_torch
62-
63-
6429
def make_compiled(
6530
bsyms: list[BoundSymbol], sorted_unique_inputs: list[Proxy], sorted_unique_outputs: list[Proxy]
6631
) -> Callable:

0 commit comments

Comments
 (0)